Prestashop总价格确认

时间:2017-05-25 10:27:01

标签: prestashop

我需要prestashop header.tpl文件的帮助。我需要获得总订单价格。我需要在javascript文件中使用此值。我试图通过使用这个来获得价格:

{print_r($cart)}
---------
{print_r($order)}
---------
sdgsdg: {$total} --:{$order->total_paid}
{$cart->getOrderTotal(true)}

{{count($cart->getProducts())}}

{foreach $cart->getProducts() as $cacheproduct }
{{$cacheproduct['id_product']}};
{/foreach}
-----<br />
{$smarty.get.id_cart}<br />
-------231241---
{$_GET['id_cart']}<br />
-adsgasdg-asd-ha-sd-h
{$total_to_pay}
{$id_order_formatted}<br /> <br />
dddsadsdas
{print_r($order->getProduct)}
fasdfasdf
{$cart->getOrderTotal(true)}

但这不起作用:/

我需要的是:在文件header.tpl中我必须得到总付费价格。 例如:

{if $page_name == "order-confirmation"}
{code to get total price}
{/if}

1 个答案:

答案 0 :(得分:0)

尝试使用覆盖

class Link extends LinkCore
{
    public function getPriceTotalByIdCart($idCart)
    {
    return Db::getInstance()->getValue('SELECT total_paid_real FROM '._DB_PREFIX_.'orders WHERE id_cart = '.(int)$idCart);
}

   public function getPriceTotalByIdOrder($idOrder)
   {
       return Db::getInstance()->getValue('SELECT total_paid_real FROM '._DB_PREFIX_.'orders WHERE id_order = '.(int)$idOrder);
   }
}

在标题tpl中:

{$link->getPriceTotalByIdCart($smarty.get.id_cart}

OR

{$link->getPriceTotalByIdOrder($smarty.get.id_order}

此致