Magento 1.9 – Get Discount and Grand Total in Mini Cart

discountmagento-1.9mini-cart

I would like to display discount amount and grand total (including discount) in mini cart with Magento 1.9 instead of sub total.

  1. I didn't find out how to display discount (cart price rule without coupon)

  2. Following this topic : How do I get the discount amount in the minicart for 1.9?

I have been able to display the grand total including the discount… but it is not working for not logged in users.

Any idea ?

Best Answer

You have to load the quote first:

<?php
    $quote = Mage::getModel('checkout/session')->getQuote();
    $quoteData = $quote->getData();
    $grandTotal = $quoteData['grand_total'];
?>

Then simply replace $this->getSubtotal() with $grandTotal.

To get the actual discount amount, you can use this:

$discountTotal = 0;
foreach ($quote->getAllItems() as $item){
    $discountTotal += $item->getDiscountAmount();
}