Try the Demo

Magento Forum

   
Display total order weight on order confirmation page
 
tony1234
Member
 
Total Posts:  38
Joined:  2010-02-15
 

Hello, is there any way of showing the total combined weight of the order at the final “thank you for your order” page?

Thank you!

 
Magento Community Magento Community
Magento Community
Magento Community
 
MagenX
Guru
 
Total Posts:  657
Joined:  2008-05-26
Dublin
 

<?php
$items 
Mage::getSingleton('checkout/cart')->getQuote()->getItemsCollection()->getItems();
$total_weight=0;
foreach( 
$items as $item )
{ $qty $item->getQty();
$product $item->getProduct();
$weight $product->getWeight();
$total_weight += ($weight*$qty);
}
echo "Total Weight = ".$total_weight;
?>

 Signature 

MagenX - Magento and Nginx Performance Tuning Services
FPC InstallationMySQL TuningServer OptimizationHOSTING - SSD SERVERS
http://www.magenx.com | | magento nginx config: http://nginxconfig.com || magento mysql settings -> my.cnf

 
Magento Community Magento Community
Magento Community
Magento Community
 
tony1234
Member
 
Total Posts:  38
Joined:  2010-02-15
 

Hi, thanks for your reply.

I’ve added the code to the foot of app/design/frontend/base/default/template/checkout/cart/success.phtml

but the result generated is

Total Weight = 0

Is there something I’ve not done correctly? Thanks again for your help!

 
Magento Community Magento Community
Magento Community
Magento Community
 
tony1234
Member
 
Total Posts:  38
Joined:  2010-02-15
 

Can anyone elaborate or help with this?

Thanks!

 
Magento Community Magento Community
Magento Community
Magento Community
 
tony1234
Member
 
Total Posts:  38
Joined:  2010-02-15
 
MagenX - 14 October 2012 05:29 AM

<?php
$items 
Mage::getSingleton('checkout/cart')->getQuote()->getItemsCollection()->getItems();
$total_weight=0;
foreach( 
$items as $item )
{ $qty $item->getQty();
$product $item->getProduct();
$weight $product->getWeight();
$total_weight += ($weight*$qty);
}
echo "Total Weight = ".$total_weight;
?>

Could you help me fix this please?

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
    Back to top