misu3108 Posted May 8, 2013 Share Posted May 8, 2013 Hi, I'm trying to modify the blockuserinfo.tpl to show not only the number of products in cart but also the order total like this (before having mouse over): Cart: $1150 (3) where: $1150 - is the order total (3) - number of products in cart Thanks. Link to comment Share on other sites More sharing options...
vekia Posted May 8, 2013 Share Posted May 8, 2013 hello, what prestashop version you use? Link to comment Share on other sites More sharing options...
vekia Posted May 8, 2013 Share Posted May 8, 2013 use this variable: {displayPrice price=$cart->getordertotal(false)} in blockuserinfo.tpl file located in your modules / blockuserinfo / blockuserinfo.tpl file remember that this file also may exists in themes/yourtheme/modules/blockuserinfo/blockuserinfo.tpl - if so - you have to apply changes there Link to comment Share on other sites More sharing options...
misu3108 Posted May 8, 2013 Author Share Posted May 8, 2013 I'm testing 1.5.4.1. Trying to migrate from 1.4.8 and I'm trying to customize the default theme a little bit.. I tried to add [i]{if !$PS_CATALOG_MODE} <li id="shopping_cart"> <a href="{$link->getPageLink($order_process, true)}" title="{l s='View my shopping cart' mod='blockuserinfo'}" rel="nofollow">{l s='Shopping bag:' mod='blockuserinfo'} <strong> {$cart->getOrderTotal(true)} </strong> <span class="ajax_cart_quantity{if $cart_qties == 0} hidden{/if}">{$cart_qties}</span>[/i] but the total price doesn't update if I remove an item from cart. I have tried your above code and it works but doesn't update price also like my first method. Thanks. Link to comment Share on other sites More sharing options...
misu3108 Posted May 8, 2013 Author Share Posted May 8, 2013 Here's an image of the cart summary in header. I also want to add "( 2 )" as the number of products in cart. Where can I add '( )' ? Link to comment Share on other sites More sharing options...
vekia Posted May 8, 2013 Share Posted May 8, 2013 but the total price doesn't update if I remove an item from cart. you've got right, it is necessary to edit javascript ajax functions... For now i don't know where exactly but i can check this to add ( 2 ) use the: ( <span class="ajax_cart_quantity{if $cart_qties == 0} hidden{/if}">{$cart_qties}</span> ) Link to comment Share on other sites More sharing options...
misu3108 Posted May 8, 2013 Author Share Posted May 8, 2013 Ok this works with the '()'. Which javascript ajax functions file needs to be modified and how to update blockuserinfo cart summary when an item is added or removed from cart? Thanks for your help Link to comment Share on other sites More sharing options...
misu3108 Posted May 9, 2013 Author Share Posted May 9, 2013 So anyone has any idea on how to do this? update price when you add or remove item from cart?? Link to comment Share on other sites More sharing options...
vekia Posted May 9, 2013 Share Posted May 9, 2013 Hello, can you share url to your store? I will check it Link to comment Share on other sites More sharing options...
misu3108 Posted May 9, 2013 Author Share Posted May 9, 2013 I would but as I was saying above I have prestashop 1.5.4.1 on a local webserver. It's not live. I'm trying to customize the new 1.5.4.1 so I can move from 1.4.8. What files do you want me to share? Link to comment Share on other sites More sharing options...
vekia Posted May 9, 2013 Share Posted May 9, 2013 I asked because sometimes after upgrade this method doesn't work. Anyway, you should try with this: for the first, you have to change the blockuserinfo.tpl once again. add the: <span id="cart_blockuserinfo">{displayPrice price=$cart->getordertotal(false)}</span> instead the old code for price (mentioned few posts above) then go to the: modules/blockcart/ajax-cart.js, you've got there something like: $('.ajax_cart_tax_cost').text(jsonData.taxCost); $('.cart_block_wrapping_cost').text(jsonData.wrappingCost); $('.ajax_block_cart_total').text(jsonData.total); right after this code, put this: $('#cart_blockuserinfo').text(jsonData.total); 1 Link to comment Share on other sites More sharing options...
misu3108 Posted May 10, 2013 Author Share Posted May 10, 2013 Great! Thanks. I'll give it a try and post the results... Link to comment Share on other sites More sharing options...
Detelin Markov Posted February 4, 2014 Share Posted February 4, 2014 Thank you vekia. This works perfectly on 1.5.6 Link to comment Share on other sites More sharing options...
hosteleriex Posted March 19, 2014 Share Posted March 19, 2014 I asked because sometimes after upgrade this method doesn't work. Anyway, you should try with this: for the first, you have to change the blockuserinfo.tpl once again. add the: <span id="cart_blockuserinfo">{displayPrice price=$cart->getordertotal(false)}</span> instead the old code for price (mentioned few posts above) then go to the: modules/blockcart/ajax-cart.js, you've got there something like: $('.ajax_cart_tax_cost').text(jsonData.taxCost); $('.cart_block_wrapping_cost').text(jsonData.wrappingCost); $('.ajax_block_cart_total').text(jsonData.total); right after this code, put this: $('#cart_blockuserinfo').text(jsonData.total); that solution did not update the total price in my presta 1.5.6.1 Link to comment Share on other sites More sharing options...
vekia Posted March 20, 2014 Share Posted March 20, 2014 strange some of merchants say that it works, you said that it doesnt. any chance to see it live somewhere? Link to comment Share on other sites More sharing options...
Kogkalidis Posted June 7, 2014 Share Posted June 7, 2014 use this variable: {displayPrice price=$cart->getordertotal(false)}in blockuserinfo.tpl file located in your modules / blockuserinfo / blockuserinfo.tpl fileremember that this file also may exists in themes/yourtheme/modules/blockuserinfo/blockuserinfo.tpl - if so - you have to apply changes there you can also use {displayPrice price=$total_price} I did it this way just because of the comma delimiter. How to update the js file in order the total on the custom cart header to be updated before visiting another page? Thanx in advance Link to comment Share on other sites More sharing options...
Aishwary Posted February 8, 2016 Share Posted February 8, 2016 use this variable: {displayPrice price=$cart->getordertotal(false)}in blockuserinfo.tpl file located in your modules / blockuserinfo / blockuserinfo.tpl fileremember that this file also may exists in themes/yourtheme/modules/blockuserinfo/blockuserinfo.tpl - if so - you have to apply changes there this solution is not working for me. i`m using astra theme and its blockuserinfo.tpl file is empty please tell me where can i apply your code to display total expense to customer on top header Link to comment Share on other sites More sharing options...
herezatajna Posted March 14, 2016 Share Posted March 14, 2016 Hi there! I would like to display the total amount (price) of the shopping cart instead of nr. of the products inside. Could someone help me, what to update, for PrestaShop1.6.0.9 Thanks a lot!Tereza Link to comment Share on other sites More sharing options...
herezatajna Posted March 16, 2016 Share Posted March 16, 2016 Hi! For all who are trying to solve this problem, I got the answer from http://stackoverflow.com/questions/36016568/how-to-display-shopping-cart-total-in-prestashop-1-6/36019672#36019672You have to edit the blockcart.css (to start displaying) and blockcart.tpl (to change the order of the information in the header).Hope it will help to anyone else Link to comment Share on other sites More sharing options...
johnnnyme Posted June 24, 2016 Share Posted June 24, 2016 Hello With herezatajna solution i have the price in the cart. But i have a problem. The registered customers in my shop shows products without VAT. So in the cart header i have the total price without VAT. Is it posible to have the real total price? I mean with VAT. Link to comment Share on other sites More sharing options...
Recommended Posts