Magento-购物车和结帐(订单检查)屏幕具有不同的字段和标签集 [英] Magento - Have different set of fields and labels for cart and checkout (order review) screens

查看:31
本文介绍了Magento-购物车和结帐(订单检查)屏幕具有不同的字段和标签集的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Magento默认主题的购物车页面中,我们在屏幕的右中间看到以下总计框:

In the Magento default theme's cart page we see the following totals box towards the right mid of the screen:

我的问题是要在购物车中显示税金"和含税总计"字段,因为一旦知道了送货地址,就会计算出税金.因此,我们只想在订单查看下的结帐屏幕中显示它.但是,当覆盖上述模板/文件时,还要修改 checkout 中的 Order Review 字段,使其看起来像这样:

My Problem is to show the Tax and Grand Total Including tax fields to appear in the cart, because the tax is calculated once we know the shipping address. So, we want to show it only in the Checkout Screen under Order Review. However, when overriding the template/ file mentioned above, also modifies the Order Review field in checkout, so that it looks like this:

和一页结帐订单查看屏幕,如

and onepage checkout order review screen like

,这意味着这些字段是由一组文件控制的.但是,我希望这两个(购物车中的总计框和结帐时的订单检查)不同.

which means that these fields are being controlled from one set of file(s). However, I want these two (totals box in cart AND order review in checkout) to be different.

通过打开模板路径提示,我知道小计,税项,总计...的子模板正在从以下位置调用:

By turning on the template path hints I know that the child templates for each of subtotal, tax, total... are being called from:

购物车:/checkout/cart.phtml

Cart: /checkout/cart.phtml

结帐(一页):/checkout/onepage/review/info.phtml

Checkout (One page): /checkout/onepage/review/info.phtml

这两个都有这条共同的路线,我相信可以做到这一点

Both of these have this common line, which I believe does the trick

$ this-> getChildHtml('totals')

有人可以帮助我了解getChildHtml如何查找总计"文件.我很困惑,因为在checkout/onepage/review文件夹中有一个totals.phtml,而它们实际上都在/tax/checkout中使用模板文件

Can someone help me in knowing how does getChildHtml looks up the 'totals' file. I am confused because there is a totals.phtml in checkout/onepage/review folder, while both of them are actually using template files in /tax/checkout

我正在使用Magento 1.4.1.1,此问题的背景是

I am using Magento 1.4.1.1 and background to this question is a previous question

推荐答案

从上一个问题开始,您已经知道输出来自文件template/tax/checkout/grandtotal.phtml.根据此代码段,决定显示1行或3行的总行:

From your previous question you already know the output comes from the file template/tax/checkout/grandtotal.phtml. It's decision to show a 1 or 3 totals lines is based on this snippet:

<?php if ($this->includeTax() && $this->getTotalExclTax()>=0):?>

我建议将其更改为...

I would suggest changing it to...

<?php if ($this->includeTax() && $this->getTotalExclTax()!=$this->getTotal()):?>

在这里,当地址未知且税额为零时,两个总计总计相等,因此仅显示一个.

Here, when the address is unknown and tax is zero, the two grand totals are equal and so only one is shown.

这是双重好处,当运费和税费估算"表格中提供了地址时,购物车仍然可以自动自动返回到三行输出.

This is doubly beneficial, when an address is supplied by the "Shipping and Tax Estimate" form then the cart can still go back to the 3-line output automatically which is smooth.

这篇关于Magento-购物车和结帐(订单检查)屏幕具有不同的字段和标签集的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆