Search This Blog

Monday, May 16, 2011

magento get last added item from session or get cart items from session

How to get all cart items from cart session in magento

$productid=Mage::getSingleton('checkout/session')->getLastAddedProductId(true);

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

No comments:

Post a Comment