How to get all cart items from cart session in magento

piaoling  2011-07-14 18:32:55

How to get all cart items from cart session in magento

 

This is one of the most usefull features for all magento developers.As it's very necessary while anybody working on Magento cart or checkout page.To get all cart item from cart session write the below code

$session= Mage::getSingleton('checkout/session');
foreach($session->getQuote()->getAllItems() as $item)
{
   $productid = $item->getProductId();
   $productsku = $item->getSku();
   $productname = $item->getName();
   $productqty = $item->getQty();
}

类别 :  magento(258)  |  浏览(3310)  |  评论(0)
发表评论(评论将通过邮件发给作者):

Email: