TesCZ Posted February 14, 2014 Share Posted February 14, 2014 Hi all! How to get variable with total price of order in order-confirmation.tpl? I'm beginner with prestashop, so this is maybe very stupid question Thanks! Link to comment Share on other sites More sharing options...
PascalVG Posted February 16, 2014 Share Posted February 16, 2014 Try $total if that doesn't work, maybe try: { $order = new Order($this->id_order)}{$order->total_paid} Hope this works, pascal Link to comment Share on other sites More sharing options...
vekia Posted February 16, 2014 Share Posted February 16, 2014 unfortunately, it's not possible to define (in smarty) new ojbects in that way Link to comment Share on other sites More sharing options...
PascalVG Posted February 16, 2014 Share Posted February 16, 2014 Ah right, sorry. The $order should be created in the tpl-calling php file... Link to comment Share on other sites More sharing options...
TesCZ Posted February 16, 2014 Author Share Posted February 16, 2014 So, $order->total_paid should works? I will test tomorrow Link to comment Share on other sites More sharing options...
vekia Posted February 16, 2014 Share Posted February 16, 2014 it should work, but you have to define $order variable in controllers (with new Order(); code) and pass it to the smarty array. Link to comment Share on other sites More sharing options...
TesCZ Posted February 16, 2014 Author Share Posted February 16, 2014 Ok, thanks. So, I will test it tomorrow Link to comment Share on other sites More sharing options...
monty86 Posted February 26, 2014 Share Posted February 26, 2014 it should work, but you have to define $order variable in controllers (with new Order(); code) and pass it to the smarty array. Please, could you explain me how and where define $order variable? Thanks Link to comment Share on other sites More sharing options...
vekia Posted February 26, 2014 Share Posted February 26, 2014 Please, could you explain me how and where define $order variable? Thanks everything depends on where you want to use $order variable Link to comment Share on other sites More sharing options...
monty86 Posted February 27, 2014 Share Posted February 27, 2014 everything depends on where you want to use $order variable Thanks, I solved my problem more or less reading other posts. Link to comment Share on other sites More sharing options...
stevensf Posted October 10, 2014 Share Posted October 10, 2014 When you solved something, please show how you have done that for others guys... tx 1 Link to comment Share on other sites More sharing options...
Gabo3D Posted November 9, 2015 Share Posted November 9, 2015 You have to assign smarty variables in OrderConfirmationController.php as it is done in the initContent() function. I had to display total paid and currency iso code because of some FB pixels. $this->context->smarty->assign(array( 'ordersTotalPaid' => $order->getOrdersTotalPaid(), 'ordersCurrency' => $currency->iso_code )); After inserting this lines into the displayPaymentReturn() function you will be able to reach these variables in your tpl file. {$ordersTotalPaid} {$ordersCurrency} Link to comment Share on other sites More sharing options...
Shurek Posted December 12, 2016 Share Posted December 12, 2016 in: override/controllers/front/OrderConfirmationController.php public function initContent() { parent::initContent(); $cart = new Cart($this->id_cart, $this->context->language->id); $products = $cart->getProducts(); $order = new Order($this->id_order); $this->context->smarty->assign(array( 'is_guest' => $this->context->customer->is_guest, 'HOOK_ORDER_CONFIRMATION' => $this->displayOrderConfirmation(), 'HOOK_PAYMENT_RETURN' => $this->displayPaymentReturn() )); if ($this->context->customer->is_guest) { $this->context->smarty->assign(array( 'id_order' => $this->id_order, 'products' => $products, 'reference_order' => $this->reference, 'ordersTotalPaid' => $order->getOrdersTotalPaid(), 'id_order_formatted' => sprintf('#%06d', $this->id_order), 'email' => $this->context->customer->email )); /* If guest we clear the cookie for security reason */ $this->context->customer->mylogout(); } $this->context->smarty->assign(array( 'id_order' => $this->id_order, 'products' => $products, 'ordersTotalPaid' => $order->getOrdersTotalPaid(), 'reference_order' => $this->reference, 'id_order_formatted' => sprintf('#%06d', $this->id_order), 'email' => $this->context->customer->email )); $this->setTemplate(_PS_THEME_DIR_.'order-confirmation.tpl'); } in /themes/theme-name/order-confirmation.tpl {sprintf("%.2f",$ordersTotalPaid)} Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now