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, 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

Magento Forum

Error when trying to getWeight()
Jr. Member
Total Posts:  4
Joined:  2009-06-17


I’m trying to get products’ weights, so I can report this on the checkout page, in the table next to Qty.

I’ve created myself a custom class with a method called get_basket_item_weight(). I am calling this from
app/design/frontend/default/default/template/checkout/cart/item/default.phtml, passing in $_item.

In my method, I just want to get the product’s weight and then multiply it by qty etc. So far I have this:

$prod_id $item->getId();
$qty $item->getQty();
$prod = new Mage_Catalog_Model_Product();

So far, so good. I now have a product populated from the database…

But then I do the obvious to get the weight:

$unit_weight $prod->getWeight();

But this gives me an error:

Notice: Undefined index:  in /home/tmpsvr4/domains/ on line 77

How do I get round this? After some googling, I’ve tried a few things to discover, and set, the product type, but no luck so far.


- Kev

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