Display total weight of cart in the magento header -


i have simple products want show total weight of cart in header section after "my cart" link.

could me resolve issue?

this should work:

$items = mage::getsingleton('checkout/session')->getquote()->getallitems();  $weight = 0; foreach($items $item) {     $weight += ($item->getweight() * $item->getqty()) ; }  echo $weight; 

a better way:

$weight = mage::getsingleton('checkout/session')               ->getquote()               ->getshippingaddress()               ->getweight(); 

Comments

Popular posts from this blog

c++ - Is it possible to compile a VST on linux? -

java - Output of Eclipse is rubbish -

jquery - Confused with JSON data and normal data in Django ajax request -