集合通常不会加载整个对象,您需要重新加载对象以获取所需的其他数据:
$session= Mage::getSingleton('checkout/session');
// Get all items, including child / hidden items
foreach($session->getQuote()->getAllItems() as $item) {
$_prod = Mage::getModel('catalog/product')->load($item->getProductId());
$productname = $_prod->getName();
$productqty = $_prod->getQty();
// Now you have a full loaded Product Object.
}
// Visible items only
foreach($session->getQuote()->getAllVisibleItems() as $item) {
$_prod = Mage::getModel('catalog/product')->load($item->getProductId());
$productname = $_prod->getName();
$productqty = $_prod->getQty();
// Now you have a full loaded Product Object.
}