This code is useful for carete a dynamic shopping cart in magento. Past this is code in header.phtml This code display total number item in cart and subtotal.
<?php
$count = $this->helper('checkout/cart')->getSummaryCount(); //get Total Items In Cart
$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));
?>
<?php
$count = $this->helper('checkout/cart')->getSummaryCount(); //get Total Items In Cart
$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));
?>
No comments:
Post a Comment