Go to app\design\frontend\Your_theme\default\template\page\html\header.phtml
Add the following code inside the header-container div to display total number of items and price in header .


<?php
$count = $this->helper('checkout/cart')->getSummaryCount();  //get total items in cart in magento 1.9
$total = $this->helper('checkout/cart')->getQuote()->getGrandTotal(); //get total price
if($count==0)
{
echo $this->__('Items: %s',$count);
}
if($count==1)
{
echo $this->__(' Item: %s',$count);
}
if($count>1)
{
echo $this->__(' Items: %s',$count);
}
echo $this->__(' Total: %s', $this->helper('core')->formatPrice($total, false));
?>

Show Items in Cart

 

<div class="cart_item">
    <?php
        if(Mage::getSingleton('checkout/session')->getQuote()->getItemsSummaryQty() > 0)
        { 
            echo __(Mage::getSingleton('checkout/session')->getQuote()->getItemsSummaryQty())?> <?php echo $this->__('');
        }
        else
        {
            echo $this->__('0');
        }
    ?> items in your cart
</div>

Categories: Magento

0 Comments

Leave a Reply

Avatar placeholder

Your email address will not be published. Required fields are marked *