将固定税添加到prestashop订单

时间:2017-02-06 16:06:21

标签: php smarty prestashop

我想在现有的prestashop网站上添加每笔订单2欧元的固定税。我已经将它添加到客户端所做的每一步中,直到我无法执行的最后一步:

我要修改的文件是" modules / bankwire / views / templates / hook / payment_return.tpl"我有这条线:

{l s='Amount' mod='bankwire'}: <span class="price"><strong>{$total_to_pay}</strong>

如果我将上一行更改为:

{l s='Amount' mod='bankwire'}: <span class="price"><strong>{$total_to_pay+2}</strong>

我的最终显示价格是四舍五入的,没有出现欧元符号(例如,如果我的总价格为54.50欧元,当我加2欧元时,它变为56而不是56,50欧元)

我该如何管理?

由于

1 个答案:

答案 0 :(得分:0)

$total_to_pay是bankwire模块中定义的格式化价格(“56,90€”而不是“56.90”):

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

您可以使用订单对象获得这样的价格:

{displayPrice price=$objOrder->getOrdersTotalPaid()}