How to get all cart items from cart session in magento

If you want to get the cart session product in magento. Than use below code and This code will also help you to show the cart product quantity and price on header section.

<?php

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


?>.

No comments:

Post a Comment