Show quantity, total price and shipping price in my header.phtml?

原创 2011年01月21日 21:10:00

Show quantity, total price and shipping price in my header.phtml?
2009-10-25 17:21

在magento论坛上的讨论,其中一个人写的:

Weehuu, finally I figured something out…

How do I show the quantity of a cart in my header?

Add the following code to app/design/frontend/[theme]/default/template/page/html/header.phtml:

 

<? if(Mage::getSingleton('checkout/session')->getQuote()->getItemsSummaryQty() > 0{ ?>
<?
=__(Mage::getSingleton('checkout/session')->getQuote()->getItemsSummaryQty())?> 
<? } 
else { ?>

<? } ?>

How do I show the total price of a cart in my header?

I have only found a solution for the subtotal, and to show this, you need to add the following to app/design/frontend/[theme]/default/template/page/html/header.phtml (or wherever you need it):

 

<? if(Mage::getSingleton('checkout/session')->getQuote()->getSubtotal() > 0{ ?>
<?
=__(number_format(Mage::getSingleton('checkout/session')->getQuote()->getSubtotal(),2))?> 
<? } 
else { ?>

<? } ?>

How do I show the total shipping price in my header?

Still trying to figure this out…

 

 

 

另外一个人写的:

I search hi and low before I found a solution and then had to do a lot of tweeking before it worked but here is what I did:

1.  Add an action method to get the subtotal in the checkout.xml file (found in app/design/frontend/default/[YOUR THEME]/layout)

Look for 
<reference name="top.links"> 
<block type="checkout/links" name="checkout_cart_link"> 
<action method="addCartLink"></action> 
<action method="addCheckoutLink"></action> 
</block>

And change to

<reference name="top.links"> 
<block type="checkout/links" name="checkout_cart_link"> 
<action method="addCartLink"></action> 
<action method="ADDSUBTOTALCODE"></action> 
<action method="addCheckoutLink"></action> 
</block>

Notice all I did was to add 
<action method="ADDSUBTOTALCODE"></action>

2.  Open links.php found in app/code/core/Mage/Checkout/Block) and Add a function to get the cart subtotal

public function ADDSUBTOTALCODE () 

if ($parentBlock = $this->getParentBlock()) 

$amount = __(number_format(Mage::getSingleton(’checkout/session’)->getQuote()->getSubtotal(),2)); 
$text = __(’Amount $%s’, $amount); 
$parentBlock->addLink($text, ‘checkout/cart’, $text, true, array(), 50,null,’class="top-link-cart"’); 


return $this; 

}

3.  Save files and upload them back to the server.

**Please ntoe to first make a backup of all the files being updated before changes are made as core files are being changed**

 

还有另外一篇文章:

http://www.magentocommerce.com/boards/viewthread/32320/

版权声明:本文为博主原创文章,未经博主允许不得转载。 举报

相关文章推荐

Highest Price in Supply Chain

题目描述 A supply chain is a network of retailers(零售商), distributors(经销商), and suppliers(供应商)-- everyon...

SD-关于定价日期的设置

最近看了一篇关于定价日期的文章,我觉得写得很不错,特将自己的理解摘抄如下: SD的定价日期有三个配置地方进行控制 1、订单类型的“定价日期建议“ 这个字段定义了订单的”定价日期建议“的默认值取值方法...

精选:深入理解 Docker 内部原理及网络配置

网络绝对是任何系统的核心,对于容器而言也是如此。Docker 作为目前最火的轻量级容器技术,有很多令人称道的功能,如 Docker 的镜像管理。然而,Docker的网络一直以来都比较薄弱,所以我们有必要深入了解Docker的网络知识,以满足更高的网络需求。

PAT 1090 Highest Price in Supply Chain

这道题用BFS求出最大层次以及最大层次上节点的个数就好了 #include #include #include #include using namespace std; struct Ans...

1106. Lowest Price in Supply Chain (25)

1106. Lowest Price in Supply Chain (25)   时间限制 200 ms 内存限制 65536 kB ...

PAT A1090 Highest Price in supply chain

//PAT A1090 ac #include #include #include using namespace std; const int maxn=100010;//注意数据大小 vect...

TJU Price

Ant is a student in Tianjin University. Everyday, he has to go to the restaurant in school. Recently...

1106. Lowest Price in Supply Chain

1106. Lowest Price in Supply Chain (25) 时间限制 200 ms 内存限制 65536 kB 代码长...

1090. Highest Price in Supply Chain (25)

1090. Highest Price in Supply Chain (25)   时间限制 200 ms 内存限制 65536 kB ...

1090. Highest Price in Supply Chain (25)

零售商+经销商+厂商=N(代号0~N-1) 厂家直销价格p 每次转手价格增加百分之r N个数(代表0~N-1从对应的代号买的,当数为-1,说明这家是厂家) 求消费者可以预期到最高价格是多少,并...

1090. Highest Price in Supply Chain (25)

几天没写代码了,找道水题写写题解
返回顶部
收藏助手
不良信息举报
您举报文章:深度学习:神经网络中的前向传播和反向传播算法推导
举报原因:
原因补充:

(最多只允许输入30个字)