bradley546994
bradley546994

Reputation: 630

Prestashop total price in order confirm

I need help with prestashop header.tpl file. I need to get total order price. This value is needed for me to use in javascript file. I'm try to get price via using this:

{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)}

but this does not work :/

What I'm need: In file header.tpl I must get total pay price. for example:

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

Upvotes: 0

Views: 2510

Answers (1)

ethercreation
ethercreation

Reputation: 1273

Try with override

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

And in header tpl with :

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

OR

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

Regards

Upvotes: 1

Related Questions