Categories: Magento

Magento get all shopping Cart Items and Totals

Show Shopping Cart Items And Totals In Magento:

With this you will be able to do following things in Magento E-Commerce

  • Get products id, name, price, quantity, etc. present in your cart.
  • Get number of items in cart and total quantity in cart.
  • Get base total price and grand total price of items in cart.

To do these functionalities you need to add specific code at the right places to get the desired effect


Get All Items Information in Magento Cart:

With the following code you can get all Magento items information in the 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->getQunatity().';
 echo 'Price: '.$item->getPrice().';
 }

Get Total Items And Total Quantity in Magento:-

For showing all Total items and Quantity in Magento you can use the following below code to get the desired results.

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

Get subtotal and grand total of price cart :-

With this code check how we can add subtotal and grand total of price to Magento cart respectively

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

Rohan pathak

Recent Posts

Where Imagination Comes to Life: Find the Best Toy Shop in Noida & Buy Toys Online in India

Toys are not just for entertainment—they shape childhood, enhancing creativity, learning, and motor skills. Whether it’s a comforting silicone night…

17 hours ago

Exploring the Magic of Toys: The Best Toy Store in Delhi

Toys are more than just playthings; they are a gateway to imagination, learning, and childhood joy. Whether it's a soft…

2 days ago

Exploring the Best Toy Store in Noida: A Paradise for Kids and Collectors

Toys have always played a crucial role in childhood, fueling imagination, creativity, and learning. Whether you're looking for educational playsets,…

5 days ago

A Unique Toy Shopping Experience: The Best Toy Store in Delhi and Across India

Toys are an essential part of childhood, shaping creativity, learning, and fun-filled memories. Whether it’s the soft embrace of plush…

6 days ago

A World of Play: The Best Toy Shopping Experience in Noida

Toys are a gateway to imagination, creativity, and learning. Whether it’s a child’s first plush toy, a set of engaging…

7 days ago

The Ultimate Guide to Finding the Best Toy Shops in Gurgaon

Toys are more than just playthings; they help children explore, learn, and develop essential life skills. From interactive sensory toys…

1 week ago