Skip to main content
5 of 5
added 8 characters in body
Amit Bera
  • 77.7k
  • 20
  • 124
  • 239

Hi you can get this details using cart session

$totals = Mage::getSingleton('checkout/session')->getQuote()->getTotals(); //Total object
$subtotal = $totals["subtotal"]->getValue(); //Subtotal value
$grandtotal = $totals["grand_total"]->getValue(); //Grandtotal value
if(isset($totals['discount']) && $totals['discount']->getValue()) {
 $discount = Mage::helper('core')->currency($totals['discount']->getValue()); //Discount value if applied
} else {
 $discount = '';
}




if(isset($totals['tax']) && $totals['tax']->getValue()) {
 $tax = $totals['tax']->getValue(); //Tax value if present
} else {
 $tax = '';
}

You can get details by Checkout session

$quote = Mage::getSingleton('checkout/session')->getQuote();
        
       

TO get the list of items in the cart :

$cartItems = $quote->getAllVisibleItems();
    

For getting each item and it details and discount :

foreach ($cartItems as $item) {
    echo $item->getQty();
$item->getPrice();
$item->getDiscountAmount();
}

For getting coupon code try this Mage::getSingleton('checkout/session')->getQuote()getCouponCode(); more details to check table sales_flat_quote_item in your magento system

Amit Bera
  • 77.7k
  • 20
  • 124
  • 239