Posting in the Magento forums has been disabled pending the implementation of a new and improved forum solution which should better serve the community.

For new questions please post at magento.stackexchange.com, the community-run support site for the Magento community. We will be providing updates on the new forum solution soon. For questions or concerns please email community@magento.com.

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
Enthusiast
 
Total Posts:  791
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;
?>
 
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 04: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