0

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();
test
  • 45
  • 8

1 Answers1

0

$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();
}
MagestyApps
  • 256
  • 1
  • 3
  • It works,thank you.Yes You are right. getAllItems() method return item array not item object. thanks for understanding this concept and fast reply – test Jan 15 '15 at 15:03