/ Published in: PHP
To display it in a cms page,
{{block type="checkout/cart" block_id="my_block" template="path_to_.phtml"}}
{{block type="checkout/cart" block_id="my_block" template="path_to_.phtml"}}
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
<?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)); ?>
URL: http://shamimcse05.wordpress.com/2010/12/23/how-to-get-total-cart-item-and-total-price-in-magento/