I m trying to get product information through item object using getProduct()
method of Mage_Sales_Quote_Item
class without a for loop. Below is my nonworking code. How do I get data of product using the getProduct()
method?
$quoteId = 5;
$quoteItemObject = Mage::getModel('sales/quote')->load($quoteId)->getAllItems();
echo $quoteItemObject->getProduct()->getName();
$quoteItemObject returns an array of all items in the quote but not a separate item. You need to "foreach" it and get information for each item separately. Try something like this:
foreach ($quoteItemObject as $item) {
echo $item->getProduct()->getName();
}