yeye412 Posted September 9, 2017 Share Posted September 9, 2017 (edited) Hello guys, do you know How can i show weight of the order in shopping cart?? I've set delivery with weight , and i want to show to buyer total price of his cart.Thanks! PS: If there's a way to show weight on product page please help me. Edited September 10, 2017 by yeye412 (see edit history) 1 1 Link to comment Share on other sites More sharing options...
ABANGWEB Posted November 9, 2017 Share Posted November 9, 2017 up up Link to comment Share on other sites More sharing options...
13thjoker Posted November 9, 2017 Share Posted November 9, 2017 Hi I dont understand, 1st sentence shopping cart 2nd sentence itsproduct page. In product page where do you want the weight? Then on cart you want on the right side like weight all products: and then the weight of all products combined? Quote and i want to show to buyer total price of his cart. What do you mean? You mean you want to show total price of his cart + shipping cost in cart? Becaulse prestashop already shows total price in cart. Daan Link to comment Share on other sites More sharing options...
ABANGWEB Posted November 9, 2017 Share Posted November 9, 2017 I think, these is about total weight on cart or page cart. any solution? Link to comment Share on other sites More sharing options...
ABANGWEB Posted November 10, 2017 Share Posted November 10, 2017 (edited) Got the answer. Go to file src\Adapter\Cart\CartPresenter.php on line 299. paste code $totalWeight = $cart->getTotalWeight(); And on line 435 paster code 'total_weight' => $totalWeight, DONE.. in php. Now go to themes/yourtheme/templates/checkout/_partial/cart-detailerd-totals.tpl On line 48 add code <div class="cart-summary-line" id="cart-subtotal-shipping"> <span class="label">Total Berat</span> <span class="value">{$cart.total_weight|string_format:"%.2f"}{Configuration::get('PS_WEIGHT_UNIT')}</span> </div> </div> Finish display check these screen shoot Edited November 10, 2017 by ABANGWEB (see edit history) 1 Link to comment Share on other sites More sharing options...
swz3000 Posted April 27, 2018 Share Posted April 27, 2018 On 2017/11/10 at 4:25 AM, ABANGWEB said: Got the answer. Go to file src\Adapter\Cart\CartPresenter.php on line 299. paste code $totalWeight = $cart->getTotalWeight(); And on line 435 paster code 'total_weight' => $totalWeight, DONE.. in php. Now go to themes/yourtheme/templates/checkout/_partial/cart-detailerd-totals.tpl On line 48 add code <div class="cart-summary-line" id="cart-subtotal-shipping"> <span class="label">Total Berat</span> <span class="value">{$cart.total_weight|string_format:"%.2f"}{Configuration::get('PS_WEIGHT_UNIT')}</span> </div> </div> Finish display check these screen shoot Hello I have followed your step, and I get this error, every time I have modify the quantity of the product, the total amount will be duplicated on another line, pls see the picture I have attached. any solution? Link to comment Share on other sites More sharing options...
swz3000 Posted April 27, 2018 Share Posted April 27, 2018 On 2017/11/10 at 4:25 AM, ABANGWEB said: Got the answer. Go to file src\Adapter\Cart\CartPresenter.php on line 299. paste code $totalWeight = $cart->getTotalWeight(); And on line 435 paster code 'total_weight' => $totalWeight, DONE.. in php. Now go to themes/yourtheme/templates/checkout/_partial/cart-detailerd-totals.tpl On line 48 add code <div class="cart-summary-line" id="cart-subtotal-shipping"> <span class="label">Total Berat</span> <span class="value">{$cart.total_weight|string_format:"%.2f"}{Configuration::get('PS_WEIGHT_UNIT')}</span> </div> </div> Finish display check these screen shoot and i'm wondering how to get the product weight in the product details like your screenshot??? Link to comment Share on other sites More sharing options...
KoreanMan Posted August 23, 2018 Share Posted August 23, 2018 I am using 1.7.3.2 I just made some changes on Cart page like below: https://www.prestashop.com/forums/topic/627417-172-show-total-weight-on-cart/ I think it's because of this... Showing error like this on Debug-Mode. ContextErrorException in Cart.php line 3601: Notice: Undefined index: in Cart.php line 3601 at ErrorHandler->handleError('8', 'Undefined index: ', '/classes/Cart.php', '3601', array('products' => null)) in Cart.php line 3601 at CartCore->getTotalWeight() in CartPresenter.php line 290 at CartPresenter->present(object(Cart)) in FrontController.php line 500 at FrontControllerCore->assignGeneralPurposeVariables() in FrontController.php line 549 at FrontControllerCore->initContent() in OrderConfirmationController.php line 93 at OrderConfirmationControllerCore->initContent() in Controller.php line 253 at ControllerCore->run() in Dispatcher.php line 428 at DispatcherCore->dispatch() in index.php line 28 What can I do?? Link to comment Share on other sites More sharing options...
bhupinda Posted January 16, 2019 Share Posted January 16, 2019 Hi, It works perfect . I'm wondering if $width , $length , $height can be called likewise . I had tried that but it is resulting into the internal error 500 . I need this to calculate the CBM of the product . It seems these variables $totalwidth etc needs to be defined somewhere . Please help Link to comment Share on other sites More sharing options...
luismfbsilva061980 Posted February 25, 2019 Share Posted February 25, 2019 Any solution for 1.7.5? 1 Link to comment Share on other sites More sharing options...
peter_lang Posted March 7, 2019 Share Posted March 7, 2019 me too for 1.7.5 Raising of amount of in cart Variables does not raise the shipping costs, still stay on the price of steh first one, the standard variable 1 Link to comment Share on other sites More sharing options...
LionelR Posted May 2, 2019 Share Posted May 2, 2019 First, big thanks ABANGWEB for the code ! It works like a charm ! If this can help someone, here's what I just did for setting it up successfully on version 1.7.5.1, locations are little different from 1.7.2 : 1 - Edit the file ../src/Adapter/Presenter/Cart/CartPresenter.php Add a new line after line 326 (after ... Cart::ONLY_PRODUCTS); ): $totalWeight = $cart->getTotalWeight(); Add a new line after line 461 (or 462 if you have add the previous line - after 'discounts' => $discounts, ): 'total_weight' => $totalWeight, 2 - Edit the file ../themes/<YourTheme>/templates/checkout/_partials/cart-detailed-totals.tpl Add a new line after line 45 ( right after {/foreach} ) and add : <div class="cart-summary-line" id="cart-subtotal-shipping"> <span class="label">Total Weight</span> <span class="value">{$cart.total_weight|string_format:"%.2f"} {Configuration::get('PS_WEIGHT_UNIT')}</span> </div> </div> You're done ! 3 Link to comment Share on other sites More sharing options...
devdesign Posted January 20, 2020 Share Posted January 20, 2020 HI, any solution for 1.7.6.2 ? Link to comment Share on other sites More sharing options...
doubleD Posted April 8, 2020 Share Posted April 8, 2020 On 1/20/2020 at 9:02 AM, devdesign said: HI, any solution for 1.7.6.2 ? The solution from LionelR works on 1.7.6.4 Link to comment Share on other sites More sharing options...
Alex Castillo Posted May 26, 2020 Share Posted May 26, 2020 (edited) Muchas Gracias. 1.7.6.2 funciona. ademas funciona en Transformer Theme: \themes\transformer\templates\checkout\_partials\ cart-sumary.tpl \modules\stshoppingcart\views\templates\hook\ *stshoppingcart-list.tpl *modal.tpl Edited May 26, 2020 by Alex Castillo (see edit history) Link to comment Share on other sites More sharing options...
grupaperun Posted July 17, 2020 Share Posted July 17, 2020 Hi, In Prestashop 1.7.6.4 works almost perfect. Just needed to move following code <div class="cart-summary-line" id="cart-subtotal-shipping"> <span class="label">Total Weight</span> <span class="value">{$cart.total_weight|string_format:"%.2f"} {Configuration::get('PS_WEIGHT_UNIT')}</span> </div> </div> after {block name='cart_summary_totals'} {include file='checkout/_partials/cart-summary-totals.tpl' cart=$cart} {/block} because it was duplicating cart total everytime I changed items quantity. Any idea how to display total weight in order-confirmation.tpl? Above solution displays value 0. 1 Link to comment Share on other sites More sharing options...
nackito Posted November 9, 2020 Share Posted November 9, 2020 On 5/2/2019 at 6:17 PM, LionelR said: First, big thanks ABANGWEB for the code ! It works like a charm ! If this can help someone, here's what I just did for setting it up successfully on version 1.7.5.1, locations are little different from 1.7.2 : 1 - Edit the file ../src/Adapter/Presenter/Cart/CartPresenter.php Add a new line after line 326 (after ... Cart::ONLY_PRODUCTS); ): $totalWeight = $cart->getTotalWeight(); Add a new line after line 461 (or 462 if you have add the previous line - after 'discounts' => $discounts, ): 'total_weight' => $totalWeight, 2 - Edit the file ../themes/<YourTheme>/templates/checkout/_partials/cart-detailed-totals.tpl Add a new line after line 45 ( right after {/foreach} ) and add : <div class="cart-summary-line" id="cart-subtotal-shipping"> <span class="label">Total Weight</span> <span class="value">{$cart.total_weight|string_format:"%.2f"} {Configuration::get('PS_WEIGHT_UNIT')}</span> </div> </div> You're done ! Work like a charm at 1.7.5.2 ! Thank you Link to comment Share on other sites More sharing options...
Alexander Firsov Posted January 21, 2021 Share Posted January 21, 2021 (edited) On 11/10/2017 at 10:25 AM, ABANGWEB said: Got the answer. Go to file src\Adapter\Cart\CartPresenter.php on line 299. paste code $totalWeight = $cart->getTotalWeight(); And on line 435 paster code 'total_weight' => $totalWeight, src\Adapter\Cart\CartPresenter.php is deprecated since 1.7.4.0 Edited January 21, 2021 by Alexander Firsov (see edit history) Link to comment Share on other sites More sharing options...
Alexander Firsov Posted January 21, 2021 Share Posted January 21, 2021 (edited) On 7/17/2020 at 10:48 PM, grupaperun said: Any idea how to display total weight in order-confirmation.tpl? Above solution displays value 0. Please make sure that you have entered the product weight in the Catalog -> Products section of Back Office Edited January 21, 2021 by Alexander Firsov (see edit history) Link to comment Share on other sites More sharing options...
Galomen Posted August 21, 2021 Share Posted August 21, 2021 On 1/21/2021 at 1:33 PM, Alexander Firsov said: Please make sure that you have entered the product weight in the Catalog -> Products section of Back Office Add Line after: $productsTotalExcludingTax = $cart->getOrderTotal(false, Cart::ONLY_PRODUCTS); $totalWeight = $cart -> getTotalWeight (); Add Line after : 'discounts' => $discounts, 'total_weight' => $totalWeight, Working 1.7.7.6 Link to comment Share on other sites More sharing options...
tibarf Posted May 27, 2023 Share Posted May 27, 2023 On 8/21/2021 at 10:51 PM, Galomen said: Add Line after: $productsTotalExcludingTax = $cart->getOrderTotal(false, Cart::ONLY_PRODUCTS); $totalWeight = $cart -> getTotalWeight (); Add Line after : 'discounts' => $discounts, 'total_weight' => $totalWeight, Working 1.7.7.6 Hello I am a newbie is this solution working also for version 1.7.8.8? Need to see the total weight on the invoice and on display. Best 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