Reputation: 1131
<?php
foreach($this->getTotals() as $total)
{
if ($total->getCode() == 'subtotal')
{
$subtotal = $total->getValue();
break;
}
}
echo $subtotal;
?>
Any way to get subtotal directly ?
Upvotes: 11
Views: 28599
Reputation: 4276
Subtotal cart with taxes:
url: http://niravkadiya.wordpress.com/2012/08/28/sub-total-of-cart-including-tax-without-shipping/
It work me!!
Upvotes: 0
Reputation: 11070
According to this site:
You can get the subtotal with:
$totals = Mage::getSingleton('checkout/cart')->getQuote()->getTotals(); $subtotal = $totals["subtotal"]->getValue();
Upvotes: 27
Reputation: 1646
$session= Mage::getSingleton('checkout/session');
$getotal = Mage::helper('checkout')->getQuote()->getGrandTotal();
$totals = Mage::getSingleton('checkout/session')->getQuote()->getTotals(); //Total object
$subtotal = $totals["subtotal"]->getValue();
"$subtotal" will hold the value of subtotal .
Thanks.
Upvotes: 0
Reputation: 3655
Try to use this:
Mage::getSingleton('checkout/cart')->getQuote()->getSubtotal()
Upvotes: 12
Reputation: 807
The following should work:
$subtotal = $this->getQuote()->getSubtotal();
Upvotes: 4