在 Prestashop 付款中获取不含税和运费的订单 ID 和价格 return
Get order id and price without tax and shipping in Prestashop payment return
请问如何在 themes/mytheme/modules/bankwire/views/templates/hook/payment_return.tpl 中获取不含税和运费的订单 ID 和价格
到这个脚本
<script type="text/javascript" id="xxxxxxxxxxx" src="https://login.dognet.sk/scripts/fj27g82d"></script>
<script type="text/javascript">
PostAffTracker.setAccountId('xxxxxxxx');
var sale = PostAffTracker.createSale();
sale.setTotalCost( ***** ); //fill price without tax and shipping
sale.setOrderID( ***** ); //fill ID order
PostAffTracker.register();
</script>
sale.setTotalCost({$price_without_tax_and_shpping}); <-- 这不起作用
Prestashop 1.6.1.13
是否用于联盟计划。
感谢帮助。
所以问题就在这里enter image description here
代码来自 root/modules/bankwire/bankwire.php
public function hookPaymentReturn($params)
{
if (!$this->active)
return;
$state = $params['objOrder']->getCurrentState();
if (in_array($state, array(Configuration::get('PS_OS_BANKWIRE'), Configuration::get('PS_OS_OUTOFSTOCK'), Configuration::get('PS_OS_OUTOFSTOCK_UNPAID'))))
{
$this->smarty->assign(array(
'total_to_pay' => Tools::displayPrice($params['total_to_pay'], $params['currencyObj'], false),
'bankwireDetails' => Tools::nl2br($this->details),
'bankwireAddress' => Tools::nl2br($this->address),
'bankwireOwner' => $this->owner,
'status' => 'ok',
'id_order' => $params['objOrder']->id,
'price_without_tax_and_shipping' => Tools::displayPrice($params['objOrder']->getTotalProductsWithoutTaxes(), $params['currencyObj'], false)
));
if (isset($params['objOrder']->reference) && !empty($params['objOrder']->reference))
$this->smarty->assign('reference', $params['objOrder']->reference);
}
else
$this->smarty->assign('status', 'failed');
return $this->display(__FILE__, 'payment_return.tpl');
}
简而言之,编辑模块:
public function hookPaymentReturn($params)
{
if (!$this->active)
return;
$state = $params['objOrder']->getCurrentState();
if (in_array($state, array(Configuration::get('PS_OS_BANKWIRE'), Configuration::get('PS_OS_OUTOFSTOCK'), Configuration::get('PS_OS_OUTOFSTOCK_UNPAID'))))
{
$this->smarty->assign(array(
'total_to_pay' => Tools::displayPrice($params['total_to_pay'], $params['currencyObj'], false),
'bankwireDetails' => Tools::nl2br($this->details),
'bankwireAddress' => Tools::nl2br($this->address),
'bankwireOwner' => $this->owner,
'status' => 'ok',
'id_order' => $params['objOrder']->id,
'price_without_tax_and_shipping' => Tools::displayPrice($params['objOrder']->getTotalProductsWithoutTaxes(), $params['currencyObj'], false),
'affiliate_price' => $params['objOrder']->getTotalProductsWithoutTaxes() // You have to add this
));
if (isset($params['objOrder']->reference) && !empty($params['objOrder']->reference))
$this->smarty->assign('reference', $params['objOrder']->reference);
}
else
$this->smarty->assign('status', 'failed');
return $this->display(__FILE__, 'payment_return.tpl');
}
然后,尝试使用 smarty {literal}
标签调整您的脚本:
<script type="text/javascript" id="xxxxxxxxxxx" src="https://login.dognet.sk/scripts/fj27g82d"></script>
<script type="text/javascript">
{literal}
PostAffTracker.setAccountId('xxxxxxxx');
var sale = PostAffTracker.createSale();
sale.setTotalCost({/literal}{$affiliate_price}{literal}); //fill price without tax and shipping
sale.setOrderID({/literal}{$id_order}{literal}); //fill ID order
PostAffTracker.register();
</script>
{/literal}
它应该在 99.99% 时工作
请问如何在 themes/mytheme/modules/bankwire/views/templates/hook/payment_return.tpl 中获取不含税和运费的订单 ID 和价格 到这个脚本
<script type="text/javascript" id="xxxxxxxxxxx" src="https://login.dognet.sk/scripts/fj27g82d"></script>
<script type="text/javascript">
PostAffTracker.setAccountId('xxxxxxxx');
var sale = PostAffTracker.createSale();
sale.setTotalCost( ***** ); //fill price without tax and shipping
sale.setOrderID( ***** ); //fill ID order
PostAffTracker.register();
</script>
sale.setTotalCost({$price_without_tax_and_shpping}); <-- 这不起作用
Prestashop 1.6.1.13 是否用于联盟计划。
感谢帮助。
所以问题就在这里enter image description here
代码来自 root/modules/bankwire/bankwire.php
public function hookPaymentReturn($params)
{
if (!$this->active)
return;
$state = $params['objOrder']->getCurrentState();
if (in_array($state, array(Configuration::get('PS_OS_BANKWIRE'), Configuration::get('PS_OS_OUTOFSTOCK'), Configuration::get('PS_OS_OUTOFSTOCK_UNPAID'))))
{
$this->smarty->assign(array(
'total_to_pay' => Tools::displayPrice($params['total_to_pay'], $params['currencyObj'], false),
'bankwireDetails' => Tools::nl2br($this->details),
'bankwireAddress' => Tools::nl2br($this->address),
'bankwireOwner' => $this->owner,
'status' => 'ok',
'id_order' => $params['objOrder']->id,
'price_without_tax_and_shipping' => Tools::displayPrice($params['objOrder']->getTotalProductsWithoutTaxes(), $params['currencyObj'], false)
));
if (isset($params['objOrder']->reference) && !empty($params['objOrder']->reference))
$this->smarty->assign('reference', $params['objOrder']->reference);
}
else
$this->smarty->assign('status', 'failed');
return $this->display(__FILE__, 'payment_return.tpl');
}
简而言之,编辑模块:
public function hookPaymentReturn($params)
{
if (!$this->active)
return;
$state = $params['objOrder']->getCurrentState();
if (in_array($state, array(Configuration::get('PS_OS_BANKWIRE'), Configuration::get('PS_OS_OUTOFSTOCK'), Configuration::get('PS_OS_OUTOFSTOCK_UNPAID'))))
{
$this->smarty->assign(array(
'total_to_pay' => Tools::displayPrice($params['total_to_pay'], $params['currencyObj'], false),
'bankwireDetails' => Tools::nl2br($this->details),
'bankwireAddress' => Tools::nl2br($this->address),
'bankwireOwner' => $this->owner,
'status' => 'ok',
'id_order' => $params['objOrder']->id,
'price_without_tax_and_shipping' => Tools::displayPrice($params['objOrder']->getTotalProductsWithoutTaxes(), $params['currencyObj'], false),
'affiliate_price' => $params['objOrder']->getTotalProductsWithoutTaxes() // You have to add this
));
if (isset($params['objOrder']->reference) && !empty($params['objOrder']->reference))
$this->smarty->assign('reference', $params['objOrder']->reference);
}
else
$this->smarty->assign('status', 'failed');
return $this->display(__FILE__, 'payment_return.tpl');
}
然后,尝试使用 smarty {literal}
标签调整您的脚本:
<script type="text/javascript" id="xxxxxxxxxxx" src="https://login.dognet.sk/scripts/fj27g82d"></script>
<script type="text/javascript">
{literal}
PostAffTracker.setAccountId('xxxxxxxx');
var sale = PostAffTracker.createSale();
sale.setTotalCost({/literal}{$affiliate_price}{literal}); //fill price without tax and shipping
sale.setOrderID({/literal}{$id_order}{literal}); //fill ID order
PostAffTracker.register();
</script>
{/literal}
它应该在 99.99% 时工作