How to show total shopping cart price in Magento Header

       If you go to pretty much any e-commerce site you will see in the header your quick cart details, these will consist of how many items are in your basket and how much your current total is. By default Magento only shows you how many items are currently in your basket and no total. As a store owner you want to give your customers as much detail as possible and knowing how much they are spending on your site is something the customer may want to know without having to go to their basket to see their current total.

       The solution below shows you how to add the price total of the basket to your basket details; this is a really easy and quick solution. Firstly navigate toyourtemplatename/page/html/header.phtml and copy the code below to where you want it displayed.

<?php
$count = $this->helper('checkout/cart')->getSummaryCount();  //get total items in cart
$total = $this->helper('checkout/cart')->getQuote()->getGrandTotal(); //get total price
echo $this->__(' Total: %s', $this->helper('core')->formatPrice($total, false));
?>
 

      That’s it, you will now be able to add products to your site and see the basket totals update in your header. Don’t forget to refresh your cache if you don’t see this code working.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值