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/escape.tmpsvr4.co.uk/public_html/app/code/core/Mage/Catalog/Model/Product/Type.php 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.