Best Magento Hosting For Small e-Commerce Stores
Page Ranking Tool

Show Shopping Cart Items And Totals In Magento

Suppose you wants to display the shopping cart Items and Shopping cart totals in the Magento, It is very easy and you can do it by using the code below:

Get all items information in cart

$items = Mage::getModel('checkout/cart')->getQuote()->getAllItems();
 $items = Mage::getSingleton('checkout/session')->getQuote()->getAllItems();

foreach($items as $item) {
 echo 'ID: '.$item->getProductId().';
 echo 'Name: '.$item->getName().';
 echo 'Sku: '.$item->getSku().';
 echo 'Quantity: '.$item->getQty().';
 echo 'Price: '.$item->getPrice().';
 }

Get total items and total quantity in cart

$totalItems = Mage::getModel('checkout/cart')->getQuote()->getItemsCount();
 $totalQuantity = Mage::getModel('checkout/cart')->getQuote()->getItemsQty();

Get subtotal and grand total price of cart

$subTotal = Mage::getModel('checkout/cart')->getQuote()->getSubtotal();
 $grandTotal = Mage::getModel('checkout/cart')->getQuote()->getGrandTotal();

Hope it helps, Thanks for your reading so keep reading.

Comments
  1. D72013

    I have read so many content on the topic of the blogger lovers but this post is in fact a nice post,
    keep it up.

  2. nice.. exactly what I’m trying to do. :D

ADD YOUR COMMENT

*