I'm using Magento 1.5.1 and I try to show the total of the cart in the sidebar cart like the checkout/cart page.
I'd like to show the coupon code percent amount if only a coupon has been applied. For now, I show the cart price with the shipping price but I need this coupon code amount to have the final cart price.
I've just managed to show the coupon code name :
$couponCode = Mage::getSingleton('checkout/session')->getQuote()->getCouponCode();
But not its value...
I find discount, subtotal, shipping, tax and grand total with the code below :
// Totals : discount, subtotal, shipping, tax, grand_total
$totals = Mage::getSingleton('checkout/cart')->getQuote()->getTotals();
foreach($this->getTotals() as $total)
{
if ($total->getCode() == 'discount')
{
$discount = $total->getValue();
break;
}
}
?>