`
haohappy2
  • 浏览: 314842 次
  • 性别: Icon_minigender_1
  • 来自: 上海
社区版块
存档分类
最新评论

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.

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics