在Prestashop付款返回

时间:2018-01-29 09:52:44

标签: javascript prestashop smarty prestashop-1.6

请如何获得订单ID和价格,不含税和运输主题/ mytheme / modules / bankwire / views / templates / hook / payment_return.tpl 到这个脚本

<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}); &lt; - 这不起作用

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');
    }

1 个答案:

答案 0 :(得分:0)

简短的方法,编辑模块:

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%