B-219 Sec-55 Noida, India
+918010221733

Magento : How to get cart subtotal and quantity

magento site : Get all items information in cart
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().’‘;
echo ““;
}
Get total items and total quantity in cart :-
$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();

Get total prize with total item in cart

<?php
$count = $this->helper(‘checkout/cart’)->getSummaryCount();  //get total items in cart
$total = $this->helper(‘checkout/cart’)->getQuote()->getGrandTotal(); //get total price

?>

(Visited 91 times, 1 visits today)

Leave a reply

You must be logged in to post a comment.