Below code will display the Cart details anywhere in Magento Site.
$totalItemsInCart = Mage::helper('checkout/cart')->getItemsCount(); //total items in cart
$totals = Mage::getSingleton('checkout/session')->getQuote()->getTotals(); //Total object
$subtotal = round($totals["subtotal"]->getValue()); //Subtotal value
$grandtotal = round($totals["grand_total"]->getValue()); //Grandtotal value
if(isset($totals['discount']) && $totals['discount']->getValue()) {
$discount = round($totals['discount']->getValue()); //Discount value if applied
} else {
$discount = '';
}
if(isset($totals['tax']) && $totals['tax']->getValue()) {
$tax = round($totals['tax']->getValue()); //Tax value if present
} else {
$tax = '';
}
$totalItemsInCart = Mage::helper('checkout/cart')->getItemsCount(); //total items in cart
$totals = Mage::getSingleton('checkout/session')->getQuote()->getTotals(); //Total object
$subtotal = round($totals["subtotal"]->getValue()); //Subtotal value
$grandtotal = round($totals["grand_total"]->getValue()); //Grandtotal value
if(isset($totals['discount']) && $totals['discount']->getValue()) {
$discount = round($totals['discount']->getValue()); //Discount value if applied
} else {
$discount = '';
}
if(isset($totals['tax']) && $totals['tax']->getValue()) {
$tax = round($totals['tax']->getValue()); //Tax value if present
} else {
$tax = '';
}
No comments:
Post a Comment