Tine Chem Posted February 23, 2010 Share Posted February 23, 2010 Hi,I am trying to figure out how to modify presta to show weight of the order in shopping cart. I have my shipping fees fixed to various weight ranges so I want to enable customers to see what is the weight of the products of their order (besides shipping fee). Weight of each product should be shown in shopping card and sum of all weights of products should be calculated at the end of the cart.Does anyone know how to make this or have anyone already done somenthing similar? Is there any module to do this?Thanks for any advices,Tinechem Link to comment Share on other sites More sharing options...
rocky Posted February 24, 2010 Share Posted February 24, 2010 To add a "Total weight" line to the shopping cart page, change lines 442-454 of order.php from: $smarty->assign(array( 'token_cart' => $token, 'productNumber' => $cart->nbProducts(), 'voucherAllowed' => Configuration::get('PS_VOUCHERS'), 'HOOK_SHOPPING_CART' => Module::hookExec('shoppingCart', $summary), 'HOOK_SHOPPING_CART_EXTRA' => Module::hookExec('shoppingCartExtra', $summary), 'shippingCost' => $cart->getOrderTotal(true, 5), 'shippingCostTaxExc' => $cart->getOrderTotal(false, 5), 'customizedDatas' => $customizedDatas, 'CUSTOMIZE_FILE' => _CUSTOMIZE_FILE_, 'CUSTOMIZE_TEXTFIELD' => _CUSTOMIZE_TEXTFIELD_, 'lastProductAdded' => $cart->getLastProduct() )); to: $smarty->assign(array( 'token_cart' => $token, 'productNumber' => $cart->nbProducts(), 'voucherAllowed' => Configuration::get('PS_VOUCHERS'), 'HOOK_SHOPPING_CART' => Module::hookExec('shoppingCart', $summary), 'HOOK_SHOPPING_CART_EXTRA' => Module::hookExec('shoppingCartExtra', $summary), 'shippingCost' => $cart->getOrderTotal(true, 5), 'shippingCostTaxExc' => $cart->getOrderTotal(false, 5), 'customizedDatas' => $customizedDatas, 'CUSTOMIZE_FILE' => _CUSTOMIZE_FILE_, 'CUSTOMIZE_TEXTFIELD' => _CUSTOMIZE_TEXTFIELD_, 'lastProductAdded' => $cart->getLastProduct(), 'weightUnit' => Configuration::get('PS_WEIGHT_UNIT') )); and then add the following at line 100 of shopping-cart.tpl in your theme's directory (after the {if $shippingCost > 0}): {l s='Total weight:'} {$cart->getTotalWeight()} {$weightUnit} 1 Link to comment Share on other sites More sharing options...
Tine Chem Posted February 24, 2010 Author Share Posted February 24, 2010 Hi, that is great, thank you for fast reply. I will incorporate this solution asap.You're the best.tinechem Link to comment Share on other sites More sharing options...
Tine Chem Posted February 24, 2010 Author Share Posted February 24, 2010 Hi I have aditional question:Is it also possible to add colum that shows weight for each product. I attached example photo. It is not needed to be exactly as on picture but somewere near product.Tinechem Link to comment Share on other sites More sharing options...
rocky Posted February 25, 2010 Share Posted February 25, 2010 In that screenshot, you've replaced the reference column with a weight column. To do that, simply change line 55 of shopping-cart.tpl from: {l s='Ref.'} to: {l s='Weight'} and line 9 of shopping-cart-product-line.tpl from: {if $product.reference}{$product.reference|escape:'htmlall':'UTF-8'}{else}--{/if} to: {if $product.weight}{$product.weight|escape:'htmlall':'UTF-8'}{/if} If you want to add it as a new column instead of replacing, you should add these lines before the reference line. Link to comment Share on other sites More sharing options...
Tine Chem Posted February 25, 2010 Author Share Posted February 25, 2010 Thanks a lot rocky.It will help me improve my store. you were very helpful.Tinechem Link to comment Share on other sites More sharing options...
Tine Chem Posted February 25, 2010 Author Share Posted February 25, 2010 In that screenshot, you've replaced the reference column with a weight column. To do that, simply change line 55 of shopping-cart.tpl from: {l s='Ref.'} to: {l s='Weight'} and line 9 of shopping-cart-product-line.tpl from: {if $product.reference}{$product.reference|escape:'htmlall':'UTF-8'}{else}--{/if} to: {if $product.weight}{$product.weight|escape:'htmlall':'UTF-8'}{/if} If you want to add it as a new column instead of replacing, you should add these lines before the reference line. Rocky I have one fast question for you. How to add weight unit under the weight colum in shopping cart. Now it only shows number... See the attached picture for reference.Thanks, Tinechem Link to comment Share on other sites More sharing options...
rocky Posted February 26, 2010 Share Posted February 26, 2010 I forgot to include it. Try this instead of the last line above: {if $product.weight}{$product.weight|escape:'htmlall':'UTF-8'} {$weightUnit}{/if} Link to comment Share on other sites More sharing options...
Aquila_77 Posted February 26, 2010 Share Posted February 26, 2010 Ciao io ho effettuato le modifiche ma non mi visualizza il peso, saresti cosi' gentile da allegarmi i 2 file modificati?Grazie Link to comment Share on other sites More sharing options...
Crotalus Posted March 21, 2010 Share Posted March 21, 2010 Hi,Your guide is wonderful and it was exactly what i needed, but...after adding the codes(and it shows up), my weight seems to show more than necessary decimal points.Each of my products are 0.3kg and 0.5kg..but when i add to the cart..it shows as 0.30000001234kg instead of just 0.3kg.May I know if is there any way to limit the decimal point or what is the best solution for this?Thanks alot. Link to comment Share on other sites More sharing options...
rocky Posted March 21, 2010 Share Posted March 21, 2010 @CrotalusChange {$product.weight} to {$product.weight|number_format:1} to display only one decimal place. Link to comment Share on other sites More sharing options...
Crotalus Posted March 21, 2010 Share Posted March 21, 2010 Thanks!I've tried it, but after some trial and error changes..haha.the result:{if $product.weight}{$product.weight|escape:'htmlall':'UTF-8'|number_format:1} {$weightUnit}{/if}Thanks again.*Now going to the next step, trying to get the darn mail function to work. Duh. Link to comment Share on other sites More sharing options...
keweli Posted June 8, 2010 Share Posted June 8, 2010 It works but how come when I do{$cart->getTotalWeight()}it shows 0 instead of 0.0001? Link to comment Share on other sites More sharing options...
rocky Posted June 8, 2010 Share Posted June 8, 2010 I had a look at the getTotalWeight() function and it appears to be rounding the total weight to 3 decimal places. You'll need to change line 904 of classes/Cart.php (in PrestaShop v1.3): $this->_totalWeight = round(floatval($result['nb']) + floatval($result2['nb']), 3); Change 3 to how many decimal places you want the total weight rounded. Link to comment Share on other sites More sharing options...
The British Food Store Posted April 23, 2011 Share Posted April 23, 2011 hi i have seen your code to show weight in basket. i am using presta 1.4, i would like to no if i can use this code and sorry to sound dumb but i am very new to this presta shop so i would like to know were i put this code.thank you in advance Link to comment Share on other sites More sharing options...
Artizzz Posted May 22, 2011 Share Posted May 22, 2011 What I need to do to make total weight update properly, it shows total weight good, but when I change quantity total weight disappears. I'm using PS 1.4.1. Link to comment Share on other sites More sharing options...
Camposinhos Posted June 30, 2011 Share Posted June 30, 2011 I forgot to include it. Try this instead of the last line above: {if $product.weight}{$product.weight|escape:'htmlall':'UTF-8'} {$weightUnit}{/if} Hi ... kinda new to this forum ... great place to evolve this platform... thank you all in advance, specially rocky that's been of great help with his tips...But still i would like to ask for your help... can i ?Got all weight working, pdf inclusive, but...on the cart summary all is ok until the customer updates de quantity... the total weight doesnt update... it only updates the total weight on F5 or CTRL+R (OSX)... any solution for this ?Thanks. Link to comment Share on other sites More sharing options...
Didrik70 Posted October 31, 2011 Share Posted October 31, 2011 Hi, I am running 1.4.5.1 and my order.php looks completely different. Can you please guide me to getting weight to show in the Shopping Cart? Link to comment Share on other sites More sharing options...
deprims2 Posted February 17, 2012 Share Posted February 17, 2012 Hi, I am running 1.4.5.1 and my order.php looks completely different. Can you please guide me to getting weight to show in the Shopping Cart? try this thread: http://www.prestashop.com/forums/topic/74831-solved-display-total-weight-in-blockcart/ follow Leeloo, Rocky and Pablowilson on first page, work perfectly on my 1.4.6.2 Link to comment Share on other sites More sharing options...
[email protected] Posted January 7, 2013 Share Posted January 7, 2013 Hi guys anyone know how to do this in 1.5 pleaseeeeeeeeeeeeeeeeeeeeeeee!!!!!!!!!!!!!! x x x x x x x x 1 Link to comment Share on other sites More sharing options...
[email protected] Posted January 7, 2013 Share Posted January 7, 2013 Rocky please help us with 1.5 thanks very much man! Link to comment Share on other sites More sharing options...
dpcdpc11 Posted January 18, 2013 Share Posted January 18, 2013 (edited) Here's how you do it for the PS 1.5.x version: Edit ParentOrderController.php and at line 366 add this: 'weightUnit' => Configuration::get('PS_WEIGHT_UNIT') Then in shopping-cart.tpl you will find 3 <tr class="cart_total_price">. At the end of each <tr> add this: <tr class="cart_total_price"> <td colspan="5">{l s='Total weight:'}</td> <td colspan="2" class="price" id="total_weight">{$cart->getTotalWeight()} {$weightUnit}</td> </tr> Please confirm if it's working for you. I've tested this in PS 1.5.3.1. EDIT: the total Weight doesn't get updated on changing the quantity via json. I've been up all night trying to figure this out but I failed god dammit! Rocky if you're out there, please save us! I've tried adding $('#total_weight').html(json.totalWeight); to cart-summary.js but it doesn't do anything. I'm not even getting any error in the web inspector. Edited January 18, 2013 by dpcdpc11 (see edit history) 2 Link to comment Share on other sites More sharing options...
Pavel B. Posted February 14, 2013 Share Posted February 14, 2013 Thank you for help, was stumbled on this for a long time Link to comment Share on other sites More sharing options...
dpcdpc11 Posted February 15, 2013 Share Posted February 15, 2013 Thank you for help, was stumbled on this for a long time Welcome! But the json update problem still remains... I have no idea how to solve that. Any help would be welcome! Link to comment Share on other sites More sharing options...
Dental Gift Posted February 16, 2013 Share Posted February 16, 2013 It work excelent for me. I am from Chile and in 1 week I have made my page www.dentalgift.cl with Prestashop and with this forum I have learned a lot. Thank you very much with you dedication. Another question ¿How can I see in the shopping cart the weight of each product? Thanks Link to comment Share on other sites More sharing options...
WEBDVL Posted March 6, 2013 Share Posted March 6, 2013 I tried editing Presto 1.4.5.1 and does not work as it should ... Appears to me while weight but one that is as the main (2kg). Product Combinations me to accumulate weight with no change to the product page, the weight does not change, still remains 2 kg Link to comment Share on other sites More sharing options...
Jorge Vargas Posted June 6, 2013 Share Posted June 6, 2013 I have 1.5.4.1 version and I did this: shopping-cart.tpl <th class="cart_description item">{l s='Description'}</th> <th class="cart_ref item">{Configuration::get('PS_WEIGHT_UNIT')}</th> shopping-cart-product-line.tpl <td class="cart_description"> <div class="narrow-screen">{l s='Description'}</div> <div class="floatL"> <p class="s_title_block"><a href="{$link->getProductLink($product.id_product, $product.link_rewrite, $product.category, null, null, $product.id_shop, $product.id_product_attribute)|escape:'htmlall':'UTF-8'}">{$product.name|escape:'htmlall':'UTF-8'}</a></p> {if isset($product.attributes) && $product.attributes}<span class="cart_prod_descrip">{$product.attributes|escape:'htmlall':'UTF-8'}</span>{/if} </div> </td> <td class="cart_ref"> <div class="narrow-screen">{Configuration::get('PS_WEIGHT_UNIT')}</div> {if $product.weight}{$product.weight|escape:'htmlall':'UTF-8'|number_format:1}{/if} </td> Link to comment Share on other sites More sharing options...
atwitz3nd Posted June 15, 2013 Share Posted June 15, 2013 Hi I have 1.5.4.1 version and I did this: shopping-cart.tpl <th class="cart_description item">{l s='Description'}</th> <th class="cart_ref item">{Configuration::get('PS_WEIGHT_UNIT')}</th> shopping-cart-product-line.tpl <td class="cart_description"> <div class="narrow-screen">{l s='Description'}</div> <div class="floatL"> <p class="s_title_block"><a href="{$link->getProductLink($product.id_product, $product.link_rewrite, $product.category, null, null, $product.id_shop, $product.id_product_attribute)|escape:'htmlall':'UTF-8'}">{$product.name|escape:'htmlall':'UTF-8'}</a></p> {if isset($product.attributes) && $product.attributes}<span class="cart_prod_descrip">{$product.attributes|escape:'htmlall':'UTF-8'}</span>{/if} </div> </td> <td class="cart_ref"> <div class="narrow-screen">{Configuration::get('PS_WEIGHT_UNIT')}</div> {if $product.weight}{$product.weight|escape:'htmlall':'UTF-8'|number_format:1}{/if} </td> Hi Jorge Any idea how to display the product.condition in the shopping cart? I'm using {$product.condition} but nothing outputs. I can output all the other fields in the product table, but not 'condition' with is a field I've customised and use lots. In shopping-cart-product-line.tpl i have {$product.condition} | {$product.name|escape:'htmlall':'UTF-8'} Do I need something somewhere else? Pleeeeese help Many Thanks Link to comment Share on other sites More sharing options...
Kiseki Posted July 1, 2013 Share Posted July 1, 2013 (edited) Thanks for the code, it's working nicely. Would it be possible to get this working with ajax so if the item quantity is increased it updates automatically? Cheers. Edited July 1, 2013 by Kiseki (see edit history) Link to comment Share on other sites More sharing options...
ALMAJ Posted July 9, 2013 Share Posted July 9, 2013 Thanks for the code, it's working nicely. Would it be possible to get this working with ajax so if the item quantity is increased it updates automatically? Cheers. 1+ Link to comment Share on other sites More sharing options...
ALMAJ Posted July 9, 2013 Share Posted July 9, 2013 Thanks for the code, it's working nicely. Would it be possible to get this working with ajax so if the item quantity is increased it updates automatically? Cheers. +1 yeah i need this too, until then we must refresh the page to update the total weight Link to comment Share on other sites More sharing options...
ALMAJ Posted July 9, 2013 Share Posted July 9, 2013 (edited) Here's how you do it for the PS 1.5.x version: Edit ParentOrderController.php and at line 366 add this: 'weightUnit' => Configuration::get('PS_WEIGHT_UNIT') Then in shopping-cart.tpl you will find 3 . At the end of each add this: {l s='Total weight:'} {$cart->getTotalWeight()} {$weightUnit} Please confirm if it's working for you. I've tested this in PS 1.5.3.1. EDIT: the total Weight doesn't get updated on changing the quantity via json. I've been up all night trying to figure this out but I failed god dammit! Rocky if you're out there, please save us! I've tried adding $('#total_weight').html(json.totalWeight); to cart-summary.js but it doesn't do anything. I'm not even getting any error in the web inspector. I can't get the weight unit in the Total Weight using this method, i only get the number alone like this: 20.00 it should appear this way: 20.00 Kg My prestashop version: 1.5.4.1 Default theme I'm doing wrong? i get confuse at this part: Edit ParentOrderController.php and at line 366 add this: 'weightUnit' => Configuration::get('PS_WEIGHT_UNIT') this file is at /controllers/front right? and at line 366 and 374 i get this: 366 'CUSTOMIZE_FILE' => Product::CUSTOMIZE_FILE, 367 'CUSTOMIZE_TEXTFIELD' => Product::CUSTOMIZE_TEXTFIELD, 368 'lastProductAdded' => $this->context->cart->getLastProduct(), 369 'displayVouchers' => $available_cart_rules, 370 'currencySign' => $this->context->currency->sign, 371 'currencyRate' => $this->context->currency->conversion_rate, 372 'currencyFormat' => $this->context->currency->format, 373 'currencyBlank' => $this->context->currency->blank, 374 'show_option_allow_separate_package' => $show_option_allow_separate_package, so i must add this code: 'weightUnit' => Configuration::get('PS_WEIGHT_UNIT') in the line 366? when i do that in the dreamweaver i get this error: "There is a syntax error on line 367. code hitting may not work until you fix this error." and did you find a solution for getting the total Weight updated on changing the quantity? the only solution i see is refreshing the page after changing the quantity of the product... but is not practical and the customers will be confused i hope some one come with a solution for this Best regards Edited July 9, 2013 by majority (see edit history) Link to comment Share on other sites More sharing options...
ALMAJ Posted July 10, 2013 Share Posted July 10, 2013 (edited) I have fixed most of the problems and adjust the code to be compatible with prestashop 1.5.4.1 So for anyone using prestashop 1.5.4.1 and having problems to add this feature please follow the updated instructions below: Instructions to display only the Total Weight at "Shopping-cart summary": 1 - go to /themes/default and edit the file "shopping-cart.tpl" 2 - you will find 5 <tr class="cart_total_price">. At the end of the 3 firsts <tr> add this: <tr class="cart_total_price"> <td colspan="5">{l s='Total weight:'}</td> <td colspan="2" class="price" id="total_weight">{$cart->getTotalWeight()} {Configuration::get('PS_WEIGHT_UNIT')}</td> </tr> Instructions to display the weight of each product at "Shopping-cart summary table": 1 - go to /themes/default and open the file shopping-cart.tpl 2 - find this: <th class="cart_description item">{l s='Description'}</th> and add this code after the previous code: <th class="cart_ref item">{Configuration::get('PS_WEIGHT_UNIT')}</th> the result should be like this. <th class="cart_product first_item">{l s='Product'}</th> <th class="cart_description item">{l s='Description'}</th> <th class="cart_ref item">{Configuration::get('PS_WEIGHT_UNIT')}</th> <th class="cart_ref item">{l s='Ref.'}</th> <th class="cart_unit item">{l s='Unit price'}</th> <th class="cart_quantity item">{l s='Qty'}</th> <th class="cart_total item">{l s='Total'}</th> <th class="cart_delete last_item"> </th> 3 - go to /themes/default and open the file shopping-cart.tpl 4 - find this code: <td class="cart_description"> <p class="s_title_block"><a href="{$link->getProductLink($product.id_product, $product.link_rewrite, $product.category, null, null, $product.id_shop, $product.id_product_attribute)|escape:'htmlall':'UTF-8'}">{$product.name|escape:'htmlall':'UTF-8'}</a></p> {if isset($product.attributes) && $product.attributes}<a href="{$link->getProductLink($product.id_product, $product.link_rewrite, $product.category, null, null, $product.id_shop, $product.id_product_attribute)|escape:'htmlall':'UTF-8'}">{$product.attributes|escape:'htmlall':'UTF-8'}</a>{/if} </td> and replace by this one: <td class="cart_description"> <div class="floatL"> <p class="s_title_block"><a href="{$link->getProductLink($product.id_product, $product.link_rewrite, $product.category, null, null, $product.id_shop, $product.id_product_attribute)|escape:'htmlall':'UTF-8'}">{$product.name|escape:'htmlall':'UTF-8'}</a></p> {if isset($product.attributes) && $product.attributes}<span class="cart_prod_descrip">{$product.attributes|escape:'htmlall':'UTF-8'}</span>{/if} </div> </td> <td class="cart_ref"> <div class="price">{if $product.weight}{$product.weight|escape:'htmlall':'UTF-8'|number_format:1} {/if}{Configuration::get('PS_WEIGHT_UNIT')}</td> Fixing the Shoping-cart summary tables (columns): now after adding the previous code lines to display the weight of each product you will noticed that the Shoping-cart summary tables (columns) are wrong (empty space on the right) we must fill that empty space using the "colspan" attribute so open the file "shopping-cart.tpl" find and replace all colspan="5" with colspan="6" Fixing the Shoping-cart summary table column Price: if the price in the summary table column is not correctly aligned at top like the other columns here is a fix: find: <td class="cart_ref">{if $product.reference}{$product.reference|escape:'htmlall':'UTF-8'}{else}--{/if}</td> <td class="cart_unit"><br /> and remove the "<br />" at the end Change the title of the weight unit at Shoping-cart summary top title table: Instead of weight unit title (KG or LB) you can changed to "Weight" and be translated at your BO here's how: find: <th class="cart_weight item">{Configuration::get('PS_WEIGHT_UNIT')}</th> and replace with this: <th class="cart_weight item">{l s='Weight'}</th> i am still finding a way to getting the total Weight updated on changing the quantity the only solution i see is refreshing the page after changing the quantity of the product... but is not practical and the customers will be confused Best regards Edited July 10, 2013 by majority (see edit history) Link to comment Share on other sites More sharing options...
chti59 Posted July 17, 2013 Share Posted July 17, 2013 @majority Wanted to try but, I have the same version 1.5.4.1, but was not able to follow the install. my shopping-cart.tpl is different and I use the original prestashop theme. <td class="cart_description"> does not exist I am really getting lost with these versions !!!! Link to comment Share on other sites More sharing options...
ALMAJ Posted July 17, 2013 Share Posted July 17, 2013 (edited) did you install a fresh installation of prestashop 1.5.4.1 or did you update from an older version? and the installation was manual or auto from simplescripts? mine is a fresh prestashop 1.5.4.1 installation and there is no difference in the files make a new fresh installation to test. Edited July 17, 2013 by majority (see edit history) Link to comment Share on other sites More sharing options...
Cortes Posted July 30, 2013 Share Posted July 30, 2013 I have fixed most of the problems and adjust the code to be compatible with prestashop 1.5.4.1 So for anyone using prestashop 1.5.4.1 and having problems to add this feature please follow the updated instructions below: Instructions to display only the Total Weight at "Shopping-cart summary": 1 - go to /themes/default and edit the file "shopping-cart.tpl" 2 - you will find 5 <tr class="cart_total_price">. At the end of the 3 firsts <tr> add this: <tr class="cart_total_price"> <td colspan="5">{l s='Total weight:'}</td> <td colspan="2" class="price" id="total_weight">{$cart->getTotalWeight()} {Configuration::get('PS_WEIGHT_UNIT')}</td> </tr> Instructions to display the weight of each product at "Shopping-cart summary table": 1 - go to /themes/default and open the file shopping-cart.tpl 2 - find this: <th class="cart_description item">{l s='Description'}</th> and add this code after the previous code: <th class="cart_ref item">{Configuration::get('PS_WEIGHT_UNIT')}</th> the result should be like this. <th class="cart_product first_item">{l s='Product'}</th> <th class="cart_description item">{l s='Description'}</th> <th class="cart_ref item">{Configuration::get('PS_WEIGHT_UNIT')}</th> <th class="cart_ref item">{l s='Ref.'}</th> <th class="cart_unit item">{l s='Unit price'}</th> <th class="cart_quantity item">{l s='Qty'}</th> <th class="cart_total item">{l s='Total'}</th> <th class="cart_delete last_item"> </th> 3 - go to /themes/default and open the file shopping-cart.tpl 4 - find this code: <td class="cart_description"> <p class="s_title_block"><a href="{$link->getProductLink($product.id_product, $product.link_rewrite, $product.category, null, null, $product.id_shop, $product.id_product_attribute)|escape:'htmlall':'UTF-8'}">{$product.name|escape:'htmlall':'UTF-8'}</a></p> {if isset($product.attributes) && $product.attributes}<a href="{$link->getProductLink($product.id_product, $product.link_rewrite, $product.category, null, null, $product.id_shop, $product.id_product_attribute)|escape:'htmlall':'UTF-8'}">{$product.attributes|escape:'htmlall':'UTF-8'}</a>{/if} </td> and replace by this one: <td class="cart_description"> <div class="floatL"> <p class="s_title_block"><a href="{$link->getProductLink($product.id_product, $product.link_rewrite, $product.category, null, null, $product.id_shop, $product.id_product_attribute)|escape:'htmlall':'UTF-8'}">{$product.name|escape:'htmlall':'UTF-8'}</a></p> {if isset($product.attributes) && $product.attributes}<span class="cart_prod_descrip">{$product.attributes|escape:'htmlall':'UTF-8'}</span>{/if} </div> </td> <td class="cart_ref"> <div class="price">{if $product.weight}{$product.weight|escape:'htmlall':'UTF-8'|number_format:1} {/if}{Configuration::get('PS_WEIGHT_UNIT')}</td> Fixing the Shoping-cart summary tables (columns): now after adding the previous code lines to display the weight of each product you will noticed that the Shoping-cart summary tables (columns) are wrong (empty space on the right) we must fill that empty space using the "colspan" attribute so open the file "shopping-cart.tpl" find and replace all colspan="5" with colspan="6" Fixing the Shoping-cart summary table column Price: if the price in the summary table column is not correctly aligned at top like the other columns here is a fix: find: <td class="cart_ref">{if $product.reference}{$product.reference|escape:'htmlall':'UTF-8'}{else}--{/if}</td> <td class="cart_unit"><br /> and remove the "<br />" at the end Change the title of the weight unit at Shoping-cart summary top title table: Instead of weight unit title (KG or LB) you can changed to "Weight" and be translated at your BO here's how: find: <th class="cart_weight item">{Configuration::get('PS_WEIGHT_UNIT')}</th> and replace with this: <th class="cart_weight item">{l s='Weight'}</th> i am still finding a way to getting the total Weight updated on changing the quantity the only solution i see is refreshing the page after changing the quantity of the product... but is not practical and the customers will be confused Best regards Point 3 must be "shopping-cart-product-line.tpl" Link to comment Share on other sites More sharing options...
cendolhejo Posted September 7, 2013 Share Posted September 7, 2013 Tested on Prestashop 1.5.5 Nice Link to comment Share on other sites More sharing options...
hollandtextiles Posted November 14, 2013 Share Posted November 14, 2013 Tested on 1.5.6 and working! It would be nice if it changed when update the quantities!!! Thanks for this Link to comment Share on other sites More sharing options...
ALMAJ Posted November 14, 2013 Share Posted November 14, 2013 I'm still not be able to get the total Weight updated on changing the quantity Link to comment Share on other sites More sharing options...
valo Posted February 14, 2014 Share Posted February 14, 2014 Thank you for this nice Support. Tested on Prestashop 1.5.6.1 Work very nice. Ofcourse to get the total Weight updated on changing the quantity, will be PERFECT Have some one found a solution ? Link to comment Share on other sites More sharing options...
valo Posted March 21, 2014 Share Posted March 21, 2014 (edited) does no one have the wrong view of columns in checkout tpl. Everything function right, but if the Client go to checkout on the last view (payment) the colums are wrong formated. I think there must be added the right colspan have Fix it: like before by shopping-cart go to /themes/yourThemes and open ORDER-PAYMENT.TPL find this: <th class="cart_description item">{l s='Description'}</th> and add this code after the previous code: <th class="cart_ref item">{Configuration::get('PS_WEIGHT_UNIT')}</th> the result should be like this .... <th class="cart_description item">{l s='Description'}</th> <th class="cart_ref item">{Configuration::get('PS_WEIGHT_UNIT')}</th> <th class="cart_ref item">{l s='Ref.'}</th> .... Then you will find 3 <tr class="cart_total_price">. At the end of each <tr> add this: <tr class="cart_total_price"> <td colspan="5">{l s='Total weight:'}</td> <td colspan="2" class="price" id="total_weight">{$cart->getTotalWeight()} {$weightUnit}</td> </tr> the result should be like this (6 x <tr class="cart_total_price">) <tr class="cart_total_price"> .... Old </tr> <tr class="cart_total_price"> .... added </tr> <tr class="cart_total_price"> .... Old </tr> <tr class="cart_total_price"> .... added </tr> <tr class="cart_total_price"> .... old </tr> <tr class="cart_total_price"> .... added </tr> Than find and replace all colspan="5" with colspan="6" My Checkout page Show now everything fine and well formated. Prestashop 1.5.6.1 Edited March 21, 2014 by valo (see edit history) Link to comment Share on other sites More sharing options...
cc10 Posted March 26, 2014 Share Posted March 26, 2014 this is a great guide.. and will use it if i can get some help with adding the weight to shopping cart without removing the reference column as we use that for different suppliers that sell the same product. so can anyone tell me the code i need to add, the files i need to edit and the lines to retain the reference column but add the weight column.? Thanks in advance. Link to comment Share on other sites More sharing options...
valo Posted March 28, 2014 Share Posted March 28, 2014 this is a great guide.. and will use it if i can get some help with adding the weight to shopping cart without removing the reference column as we use that for different suppliers that sell the same product. so can anyone tell me the code i need to add, the files i need to edit and the lines to retain the reference column but add the weight column.? Thanks in advance. ehhhhh, what about reading from page #1 ?? Link to comment Share on other sites More sharing options...
RudiFD Posted April 2, 2014 Share Posted April 2, 2014 Thank you for this nice Support. Tested on Prestashop 1.5.6.1 Work very nice. Ofcourse to get the total Weight updated on changing the quantity, will be PERFECT Have some one found a solution ? I guess I found a solution to solve your problem. Here is what I did: in "Modules -> Blockcart -> blockcart-json.tpl" at line 109 change "shippingCost": "{$shipping_cost|html_entity_decode:2:'UTF-8'}", to 'totalWeight': '{$total_weight|html_entity_decode:2:'UTF-8'}', In "Modules -> Blockcart -> Ajax-cart.js" at line 650 change $('.ajax_cart_shipping_cost').text(jsonData.shippingCost); to $('.ajax_cart_shipping_cost').text(jsonData.shippingCost);$('.ajax_block_cart_weight').text(jsonData.totalWeight); That solved it for me in total shipping weight and in product weight. 1 Link to comment Share on other sites More sharing options...
valo Posted April 7, 2014 Share Posted April 7, 2014 @RudiFD have trying but nothing happen. The total weight don´t want to refresh. Only after pressing F5 (refresh Browser) is working, but it works before too. Link to comment Share on other sites More sharing options...
PrashantG Posted April 18, 2014 Share Posted April 18, 2014 (edited) It didn't work on Prestashop 1.6. Kindly Guide me to show Total weight in Cart Edited April 18, 2014 by PrashantG (see edit history) Link to comment Share on other sites More sharing options...
jimmyc Posted April 25, 2014 Share Posted April 25, 2014 subbing to this thread. A sorely missed feature of prestashop. Link to comment Share on other sites More sharing options...
PrashantG Posted April 25, 2014 Share Posted April 25, 2014 Dear Please provide step to step guide for Prestashop 1.6 Its Urgent Link to comment Share on other sites More sharing options...
PrashantG Posted April 29, 2014 Share Posted April 29, 2014 Hi guys anyone know how to do this in 1.6 pleaseeeeeeeeeeeessss Link to comment Share on other sites More sharing options...
jimmyc Posted May 16, 2014 Share Posted May 16, 2014 there is a feature request for this in the suggestions thread http://feedback.prestashop.com/forums/124931-general/suggestions/5830800-show-total-order-weight-in-cart-also-in-product-d#comments vote it up and add comments. Link to comment Share on other sites More sharing options...
Alugart Posted August 4, 2014 Share Posted August 4, 2014 Oh God, its already august, and no solution to the cart/total weight problem in 1.6 ? It is so frustrating! Link to comment Share on other sites More sharing options...
Alugart Posted August 13, 2014 Share Posted August 13, 2014 engineerHopf kindly shared a code for 1.6 on how to add a total weight of the order in the shopping cart (NO SOLUTION HAS YET BEEN FOUND ON HOW TO MAKE THE WEIGHT TO AUTO UPDATE WHEN YOU CHANGE QUANTITIES ORDERED IN THE CART, YOU HAVE TO REFRESH PAGE MANUALLY) in /themes/yourtheme/shopping-cart.tpl above </ tfoot> insert the following code: <tr class="cart_total_delivery"><td colspan="5" class="text-right">{l s='Total Weight:'}</td><td colspan="2" class="price">{$cart->getTotalWeight()}  {Configuration::get('PS_WEIGHT_UNIT')} </td></tr> Link to comment Share on other sites More sharing options...
oskar86 Posted October 5, 2014 Share Posted October 5, 2014 (edited) Hello PS community! This is my first post here. Somehow I got it working (at least for me:)) - the total weight in shopping cart summary, and auto update on quantity change. Maybe someone else can make use of it. My PrestaShop version 1.6.0.9 We need to change following files: shopping-cart.tpl in catalogue /themes/yourshop/ We need to add following code: <tr class="cart_total_price"> <td colspan="{$col_span_subtotal}" class="text-right"><span>{l s='Total weight'}</span></td> <td colspan="2" class="price"><span class="ajax_block_cart_weight">{$cart->getTotalWeight()|escape:'htmlall':'UTF-8'|number_format:3} {Configuration::get('PS_WEIGHT_UNIT')}</span></td> </tr> you can add this right above the code: </tfoot> blockcart-json.tpl in catalogue /themes/yourshop/modules/blockcart add line: "totalWeight": {$total_weight|json_encode}, you can place it right below the: "shippingCost": {$shipping_cost|json_encode}, blockcart.php in catalogue /modules/blockcart add following line: $totalWeight = $params['cart']->getTotalWeight().' '.Configuration::get('PS_WEIGHT_UNIT'); you can add this line below following: $totalToPay = $params['cart']->getOrderTotal($useTax); and in the same file add line 'total_weight' => $totalWeight you can add this below the following code: 'free_shipping' => $total_free_shipping, ajax-cart.js in catalogue: /themes/yourshop/js/modules/blockcart/ add following line: $('.ajax_block_cart_weight').text(jsonData.totalWeight); you can add it below: $('.ajax_total_price_wt').text(jsonData.total_price_wt); I'm a PS newbie so if I made mistakes, please correct. Everyone please pay attention to folders paths as it's crucial to get it working. There are also some issues with rows/columns appearance in shopping cart (due to shopping-cart.tpl modifications), and basically what I did to keep them on place is (as I remember correctly) I changed in same file everywhere following <td rowspan="{3+ to <td rowspan="{4+ and it worked for me. Cheers Edited October 5, 2014 by oskar86 (see edit history) 8 Link to comment Share on other sites More sharing options...
Alugart Posted October 27, 2014 Share Posted October 27, 2014 Wow, that actually worked! I tried on my both development test site, it worked. Then I applied to my main site - it worked! Issue solved, just follow steps in previous post. Tested for PrestaShop version: 1.6.0.5 Amazing work oksar86, thank you very-very much! Link to comment Share on other sites More sharing options...
monkata Posted November 28, 2014 Share Posted November 28, 2014 Great! Works for me too 1.6.0.9 at the moment Link to comment Share on other sites More sharing options...
hdp2101 Posted December 7, 2014 Share Posted December 7, 2014 hello where can i find order.php in prestashop 1.6x Link to comment Share on other sites More sharing options...
xiparos Posted January 22, 2015 Share Posted January 22, 2015 Works like a charm in 1.6.0.11 ! Link to comment Share on other sites More sharing options...
waitmyway3172 Posted February 15, 2015 Share Posted February 15, 2015 Hello all, I am using 1.6.0.6,and the above solution are not working with my version, anybody can help? Link to comment Share on other sites More sharing options...
sugarboy Posted March 18, 2015 Share Posted March 18, 2015 (edited) Thanks Oscar86 you save me lot of problems. As he denotes " Everyone please pay attention to folders paths as it's crucial to get it working." Confirmed works great on 1.6.0.14 but with manual refresh, any suggestions? Edited March 18, 2015 by sugarboy (see edit history) Link to comment Share on other sites More sharing options...
sugarboy Posted March 18, 2015 Share Posted March 18, 2015 (edited) Hello all, I am using 1.6.0.6,and the above solution are not working with my version, anybody can help? Pay more attention in configuration paths. moreover maybe you should have to modify (like in my case) at blockcart-json.tpl the script after the pipe. What I mean: Literally you should place "totalWeight": {$total_weight | json_encode}, (maybe you should need to replace) right below "shippingCost": {$shipping_cost | json_encode}, as oscar86 instructs. but you should check what is the statement after the pipe mark at YOURS shipping cost variable and replace the json_encode in total weight variable to match exactly. I did wrong at the first attempt and had all the e-shop to crash. Edited March 18, 2015 by sugarboy (see edit history) Link to comment Share on other sites More sharing options...
Pinturas Dami Posted April 15, 2015 Share Posted April 15, 2015 I guess I found a solution to solve your problem. Here is what I did: in "Modules -> Blockcart -> blockcart-json.tpl" at line 109 change "shippingCost": "{$shipping_cost|html_entity_decode:2:'UTF-8'}", to 'totalWeight': '{$total_weight|html_entity_decode:2:'UTF-8'}', In "Modules -> Blockcart -> Ajax-cart.js" at line 650 change $('.ajax_cart_shipping_cost').text(jsonData.shippingCost); to $('.ajax_cart_shipping_cost').text(jsonData.shippingCost);$('.ajax_block_cart_weight').text(jsonData.totalWeight); That solved it for me in total shipping weight and in product weight. Hi RudiFD. I tried this code but it didn't work. Have you got any other idea? Thanks for your help. Link to comment Share on other sites More sharing options...
jetx Posted August 24, 2015 Share Posted August 24, 2015 Hello PS community! This is my first post here. Somehow I got it working (at least for me:)) - the total weight in shopping cart summary, and auto update on quantity change. Maybe someone else can make use of it. My PrestaShop version 1.6.0.9... As at 1.6.1 this method works. Thanks for this!! A note to PS core devs, this feature is absolutely needed to be built in, rather than having to modify files every time there is an update. Link to comment Share on other sites More sharing options...
schmuck-leder-online Posted September 1, 2015 Share Posted September 1, 2015 @jetx As at 1.6.1 this method works. Thanks for this!! A note to PS core devs, this feature is absolutely needed to be built in, rather than having to modify files every time there is an update. Is your shop's version 1.6.1.1 ? Does Weight of each item and Total weight show correctly in the cart? does it auto update each time changing the carts contents? Link to comment Share on other sites More sharing options...
sounds Posted October 11, 2015 Share Posted October 11, 2015 (edited) Is this just wishful thinking or did I see an option to display the total weight in the checkout page and product page? Would it not seem like an obvious display feature to have for your products? rather than editing code to show weight My worst nightmare is when I update ps, my previous edits will be gone, maybe I need to do edits in custom css files? Or maybe they could just add this feature as default, but then again, some people make a few bucks off this feature. Edited October 11, 2015 by sounds (see edit history) Link to comment Share on other sites More sharing options...
Simone A. Posted December 3, 2015 Share Posted December 3, 2015 Hello PS community! This is my first post here. Somehow I got it working (at least for me:)) - the total weight in shopping cart summary, and auto update on quantity change. Maybe someone else can make use of it. My PrestaShop version 1.6.0.9 We need to change following files: shopping-cart.tpl in catalogue /themes/yourshop/ We need to add following code: <tr class="cart_total_price"> <td colspan="{$col_span_subtotal}" class="text-right"><span>{l s='Total weight'}</span></td> <td colspan="2" class="price"><span class="ajax_block_cart_weight">{$cart->getTotalWeight()|escape:'htmlall':'UTF-8'|number_format:3} {Configuration::get('PS_WEIGHT_UNIT')}</span></td> </tr> [...] That's great, work also for me! Very thanks! Somebody know if is possible write this weight data also in drop-down cart? Link to comment Share on other sites More sharing options...
swz3000 Posted September 1, 2016 Share Posted September 1, 2016 Hello PS community! This is my first post here. Somehow I got it working (at least for me:)) - the total weight in shopping cart summary, and auto update on quantity change. Maybe someone else can make use of it. My PrestaShop version 1.6.0.9 We need to change following files: shopping-cart.tpl in catalogue /themes/yourshop/ We need to add following code: <tr class="cart_total_price"> <td colspan="{$col_span_subtotal}" class="text-right"><span>{l s='Total weight'}</span></td> <td colspan="2" class="price"><span class="ajax_block_cart_weight">{$cart->getTotalWeight()|escape:'htmlall':'UTF-8'|number_format:3} {Configuration::get('PS_WEIGHT_UNIT')}</span></td> </tr> you can add this right above the code: </tfoot> blockcart-json.tpl in catalogue /themes/yourshop/modules/blockcart add line: "totalWeight": {$total_weight|json_encode}, you can place it right below the: "shippingCost": {$shipping_cost|json_encode}, blockcart.php in catalogue /modules/blockcart add following line: $totalWeight = $params['cart']->getTotalWeight().' '.Configuration::get('PS_WEIGHT_UNIT'); you can add this line below following: $totalToPay = $params['cart']->getOrderTotal($useTax); and in the same file add line 'total_weight' => $totalWeight you can add this below the following code: 'free_shipping' => $total_free_shipping, In "Modules -> Blockcart -> Ajax-cart.js" at line 650 change $('.ajax_cart_shipping_cost').text(jsonData.shippingCost); to $('.ajax_cart_shipping_cost').text(jsonData.shippingCost);$('.ajax_block_cart_weight').text(jsonData.totalWeight); That solved it for me in total shipping weight and in product weight. tested perfectly by this steps on 1.6.1.3...), thanks all... Link to comment Share on other sites More sharing options...
Steve Joms Posted November 9, 2016 Share Posted November 9, 2016 Hi Guys, I've tried to follow all the instruction by oskar86 actually it is working but the auto update of total weight is not working, if I add quantity there is no changes in total weight I must I have to refresh the page to make it change. I'm using PS 1.6.0.9 Thanks! Link to comment Share on other sites More sharing options...
Simone A. Posted November 9, 2016 Share Posted November 9, 2016 Hi Guys, I've tried to follow all the instruction by oskar86 actually it is working but the auto update of total weight is not working, if I add quantity there is no changes in total weight I must I have to refresh the page to make it change. I'm using PS 1.6.0.9 Thanks! Hello, there is no direct solution unfortunately. I Think the only way is add a refresh command every time user change quantity in the cart. Link to comment Share on other sites More sharing options...
Steve Joms Posted November 10, 2016 Share Posted November 10, 2016 Hello, there is no direct solution unfortunately. I Think the only way is add a refresh command every time user change quantity in the cart. I see, no choice I think I must have to put a refresh button beside my total weight. Thank you very much Simone A. Link to comment Share on other sites More sharing options...
tarmogr Posted December 14, 2016 Share Posted December 14, 2016 (edited) Somehow I got it working (at least for me:)) - the total weight in shopping cart summary, and auto update on quantity change. Confirmed works great on 1.6.0.14 but with manual refresh, any suggestions? So can anyone confirm the auto update works or not, im confused Edited December 14, 2016 by tarmogr (see edit history) Link to comment Share on other sites More sharing options...
Steve Joms Posted December 21, 2016 Share Posted December 21, 2016 So can anyone confirm the auto update works or not, im confused Hi tarmogr, I'm using 1.6.0.9 but no luck of having that auto update I just put an update button to do that. Link to comment Share on other sites More sharing options...
oscarfox01 Posted July 3, 2017 Share Posted July 3, 2017 Great!! Thanks a lot oskar86!! I just did it all and it totally works!! By the way, I did it on PS v1.6.1.10 and everything works great, even the auto-update, but as oskar86 said, you gotta be really carefull with locations. Link to comment Share on other sites More sharing options...
yeye412 Posted September 10, 2017 Share Posted September 10, 2017 Any way to show weight othe order in 1.7.2 ps version? Thanks Link to comment Share on other sites More sharing options...
johnt Posted November 28, 2017 Share Posted November 28, 2017 Thank you oskar86! The instructions work on 1.6.1.17. But there is no auto update of weight when changing quantities. Anyone found a fix for this ?? Link to comment Share on other sites More sharing options...
johnt Posted December 2, 2017 Share Posted December 2, 2017 On 10/5/2014 at 11:15 PM, oskar86 said: "totalWeight": {$total_weight|json_encode}, About the auto update to work, it seems that this line of code must be placed in the following blockcart-json.tpl /modules/blockcart_mod/views/templates/hook/blockcart-json.tpl Link to comment Share on other sites More sharing options...
karcharoth Posted January 15, 2019 Share Posted January 15, 2019 (edited) Hi, I have achieved it in 1.6.1.20 PS instance by following modifications (with autoupdate): File: \classes\Cart.php (but you should use override here) -> added following lines: 3167: $total_weight = $this->getTotalWeight(); 3256: 'total_weight' => $total_weight, File: \themes\yourtheme\js\cart-summary.js -> added following line: 958: $('#total_weight').html(json.total_weight); File: \themes\yourtheme\shopping-cart.tpl -> added following lines in proper place of your template shopping-cart.tpl file: <tr class="cart_total_weight"> <td colspan="{$col_span_subtotal}" class="text-right">{l s='Total weight'}</td> <td colspan="4" class="price"><span id="total_weight">{$cart->getTotalWeight()}</span> {Configuration::get('PS_WEIGHT_UNIT')}</td> </tr> Edited January 15, 2019 by karcharoth (see edit history) 1 Link to comment Share on other sites More sharing options...
tcladin Posted April 4, 2019 Share Posted April 4, 2019 (edited) On 11/28/2017 at 1:10 AM, johnt said: Thank you oskar86! The instructions work on 1.6.1.17. But there is no auto update of weight when changing quantities. Anyone found a fix for this ?? edit /themes/default-bootstrap/js/cart-summary.js no Ajax-cart.js and else here is my develop notes, may help you, use posts in this thred to obtain it, combine oskar86 and karcharoth post worikg well here PS1.6.0.9 <? //themes/default-bootstrap/modules/blockcart/blockcart-json.tpl "totalWeight": {$total_weight|json_encode},{* tcl 2019-04-02 *} //themes/default-bootstrap/product.tpl <p >{* tcl 2019-04-02 *} <label>{l s='Hmotnost:'} </label> <span class="editable">{round($product->weight,2)} kg</span> </p>{* konec tcl 2019-04-02 *} //themes/default-bootstrap/shopping-cart.tpl <tr class="cart_total_weight">{* tcl 2019-04-02 *} <td colspan="{$col_span_subtotal}" class="text-right"><span>{l s='Celková hmotnost'}</span></td> <td colspan="2" class="price"><span id="total_weight">{$cart->getTotalWeight()|escape:'htmlall':'UTF-8'|number_format:3} {Configuration::get('PS_WEIGHT_UNIT')}</span></td>{* konec tcl 2019-04-02 *} </tr> <td rowspan="{3+$total_discounts_num+$use_show_taxes+$total_wrapping_taxes_num+1} " colspan="2" id="cart_voucher"class="cart_voucher"> <td rowspan="{3+$total_discounts_num+$use_show_taxes+$total_wrapping_taxes_num+1} {* tcl 2019-04-02 *}" colspan="2" id="cart_voucher" class="cart_voucher"> //classes/Cart.php $total_weight = $this->getTotalWeight(); 'total_weight' => $total_weight.' '.Configuration::get('PS_WEIGHT_UNIT') /*tcl*/ //themes/default-bootstrap/js/cart-summary.js $('#total_weight').html(json.total_weight); /*tcl*/ Edited April 4, 2019 by tcladin code correction (see edit history) Link to comment Share on other sites More sharing options...
juanrojas Posted December 4, 2019 Share Posted December 4, 2019 Hello, I am interested in this topic for version 1.7 and the total weight was visible in the new order email 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