Magento - 修改购物车和结帐(订单审核)屏幕的标签

发布于 2024-10-03 16:47:03 字数 1079 浏览 4 评论 0原文

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

我想修改上面框中5个字段的标签,已经可以更改Grand总计,通过覆盖以下设计文件:

/html/app/design/frontend/default/mine/template/tax/checkout/grandtotal.phtml

所以,现在看起来像这样:

alt text

我的问题是:

更改框中其他 3 个字段的标签,以及折扣框的标签(如果适用折扣)。我花了一些时间搜索其他设计文件,但找不到任何文件。可能有一些类需要覆盖,但我也无法找到它们。

我正在使用 Magento 1.4.1.1

更新 1:打开模板路径提示后,以下是模板路径 购物车

小计: 应用程序/设计/前端//tax/checkout/subtotal.phtml

总计: 应用程序/设计/前端//checkout/total/default.phtml

总计: 应用程序/设计/前端//tax/checkout/grandtotal.phtml

税: 应用程序/设计/前端//tax/checkout/tax.phtml

Checkout

与购物车相同,并且以下附加一项用于

运费:app/design/frontend//tax/checkout/shipping.phtml

但是,当人们进入这些模板文件时,除了 grandtotal.phtml 之外,没有找到任何标签。

我找到了问题的解决方案,我在自己的答案中提到过。

这个问题最初是在两个不同的问题上寻求帮助。我稍后将另一个发布为

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

I want to modify the labels of the 5 fields in the above box, and I have been able to change the Grand Totals, by overriding the following design file:

/html/app/design/frontend/default/mine/template/tax/checkout/grandtotal.phtml

So, now it looks like this:

alt text

My Problem is to:

Change the labels for other 3 fields in the box, and the label of a discount box that appears there if a discount applies. I have spent some time grepping through other design files, but couldn't find any. It might be some classes to override, but I haven't been able to locate them either.

I am using Magento 1.4.1.1

UPDATE 1: After turning on template path hints, following are template paths for
Cart

Subtotal:
app/design/frontend//tax/checkout/subtotal.phtml

Total:
app/design/frontend//checkout/total/default.phtml

GrandTotal:
app/design/frontend//tax/checkout/grandtotal.phtml

Tax:
app/design/frontend//tax/checkout/tax.phtml

Checkout

Same as for cart and the following additional one for

Shipping: app/design/frontend//tax/checkout/shipping.phtml

But when one goes into these template files, no labels are found except in grandtotal.phtml.

I found the solution to the problem, which I have mentioned in my own answer.

This question originally asked for help on two separate problems. I posted the other one later as another question.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(6

给妤﹃绝世温柔 2024-10-10 16:47:03

为什么不使用内联翻译器或区域设置文件更改标签?

 grep 'Grand Total'  app/locale/ -rsn

app/locale/en_US/Mage_Tax.csv:55:"总计(不含税)","总计(不含税)"
app/locale/en_US/Mage_Tax.csv:56:"总计(不含税)","总计(不含税)"
app/locale/en_US/Mage_Tax.csv:57:"总计(含税)","总计(含税)"
app/locale/en_US/Mage_Tax.csv:58:"总计(含税)","总计(含税)"
app/locale/en_US/Mage_Tax.csv:59:"不含税总计","不含税总计"
app/locale/en_US/Mage_Tax.csv:60:"含税总计","含税总计"
app/locale/en_US/Mage_Tax.csv:66:"在总计中包含税收","在总计中包含税收"
app/locale/en_US/Mage_Rss.csv:22:"总计","总计"
app/locale/en_US/Mage_Adminhtml.csv:366:"总计","总计"
app/locale/en_US/Mage_Customer.csv:146:"总计","总计"
app/locale/en_US/Mage_Sales.csv:216:"总计","总计"
app/locale/en_US/Mage_Sales.csv:217:"要收费的总计","要收费的总计"
app/locale/en_US/Mage_Sales.csv:373:"订单总计","订单总计"
app/locale/en_US/Mage_Checkout.csv:104:"Grand Total:","Grand Total:"

或获取使用此字符串的模板:

 grep "__('Grand Total" app/design/ -rsn

Why don't you change the labels with inline translator or in locale files?

 grep 'Grand Total'  app/locale/ -rsn

app/locale/en_US/Mage_Tax.csv:55:"Grand Total (Excl. Tax)","Grand Total (Excl. Tax)"
app/locale/en_US/Mage_Tax.csv:56:"Grand Total (Excl.Tax)","Grand Total (Excl.Tax)"
app/locale/en_US/Mage_Tax.csv:57:"Grand Total (Incl. Tax)","Grand Total (Incl. Tax)"
app/locale/en_US/Mage_Tax.csv:58:"Grand Total (Incl.Tax)","Grand Total (Incl.Tax)"
app/locale/en_US/Mage_Tax.csv:59:"Grand Total Excl. Tax","Grand Total Excl. Tax"
app/locale/en_US/Mage_Tax.csv:60:"Grand Total Incl. Tax","Grand Total Incl. Tax"
app/locale/en_US/Mage_Tax.csv:66:"Include Tax In Grand Total","Include Tax In Grand Total"
app/locale/en_US/Mage_Rss.csv:22:"Grand Total","Grand Total"
app/locale/en_US/Mage_Adminhtml.csv:366:"Grand Total","Grand Total"
app/locale/en_US/Mage_Customer.csv:146:"Grand Total","Grand Total"
app/locale/en_US/Mage_Sales.csv:216:"Grand Total","Grand Total"
app/locale/en_US/Mage_Sales.csv:217:"Grand Total to be Charged","Grand Total to be Charged"
app/locale/en_US/Mage_Sales.csv:373:"Order Grand Total","Order Grand Total"
app/locale/en_US/Mage_Checkout.csv:104:"Grand Total:","Grand Total:"

or get the templates where this string is used:

 grep "__('Grand Total" app/design/ -rsn
迟月 2024-10-10 16:47:03

问题1的答案:

解决方案是覆盖

功能:
fetch(Mage_Sales_Model_Quote_Address $地址)

位于:code/core/Mage/Sales/Model/Quote/Address/Total/Shipping.php

同样,应编辑同一文件夹中的文件 Tax 和 Subtotal 以获得所需的结果。

该解决方案是对Magento 社区论坛上的解决方案的修改

Answer to Problem 1:

The solution is to override the

function:
fetch(Mage_Sales_Model_Quote_Address $address)

in: code/core/Mage/Sales/Model/Quote/Address/Total/Shipping.php

Similarly the files Tax and Subtotal in the same folder should be edited for desired results.

The solution is a modification of a solution on the Magento community forum

§对你不离不弃 2024-10-10 16:47:03

我知道这个线程有点旧,但我最近不得不自己解决这个问题。满足我的需求的最简单的解决方案是重写 Mage_Checkout_Block_Cart_Totals 类并覆盖 renderTotals 函数。它最终看起来像这样:

public function renderTotals($area = null, $colspan = 1)
{
    return $this->_replaceLabels(parent::renderTotals($area, $colspan));
}


protected function _replaceLabels($html){
    $labelMap = array();
    $labelMap['Subtotal'] = "Product Total";
    $labelMap['Grand Total'] = "Order Total";
    $labelMap["Shipping & Handling"] = "Shipping";

    foreach($labelMap as $key => $value){
        $html = str_replace($key, $value,$html) ;
    }
    return $html;
}

可能有更干净的方法来做到这一点,但这对我来说是最快的。

I know this thread is a little old but i recently had to solve this problem my self. The easiest solution for my needs was to rewrite the Mage_Checkout_Block_Cart_Totals class and override the renderTotals function. It ended up looking something like this:

public function renderTotals($area = null, $colspan = 1)
{
    return $this->_replaceLabels(parent::renderTotals($area, $colspan));
}


protected function _replaceLabels($html){
    $labelMap = array();
    $labelMap['Subtotal'] = "Product Total";
    $labelMap['Grand Total'] = "Order Total";
    $labelMap["Shipping & Handling"] = "Shipping";

    foreach($labelMap as $key => $value){
        $html = str_replace($key, $value,$html) ;
    }
    return $html;
}

There might be cleaner ways to do this, but this was the fastest for me.

画尸师 2024-10-10 16:47:03

我首先打开模板路径提示。这将为您提供一个起点,了解哪个模板正在呈现最终 HTML 的哪些部分。从那里您可以查看模板,并查看 phtml 模板(或其父块)从何处提取文本。

I'd start by flipping on template path hints. That will give you a starting point as to which template is rendering which sections of the final HTML. From there you can view the template, and see where the phtml template (or its parent block) is pulling the text from.

若能看破又如何 2024-10-10 16:47:03

当然,最快、最安全的方法一定是使用内联翻译

Surely the quickest and safest way must be to use inline translation.

甜宝宝 2024-10-10 16:47:03

如果您的要求只是更改标签,则可以从“区域设置”更改它。例如,如果您的商店区域设置是“美国”,请转到“app/locale/en_US/Mage_Tax.csv”,搜索您要更改的文本。例如:如果要将标签“税”更改为“增值税”,则搜索“税”,然后将其替换为“增值税”。通过这种方式,您可以轻松更改标签。如果您的商店设置为澳大利亚,请在区域设置文件夹中创建一个名为“en_AU”的文件夹,将 Mage_Tax.csv 复制到该文件夹​​并进行上述更改。这将解决您的问题。

If your requirement is to only change the labels than you can change it from "locale". If your store locale is "United States" for example than go to "app/locale/en_US/Mage_Tax.csv", search for the text you want to change. For example: If you want to change the label "Tax" to "VAT", then search for Tax and then replace it with "VAT". IN this way you can easily change your labels. If you have your store setup for Australia,in the locale folder create a folder named "en_AU", copy Mage_Tax.csv to that folder and make the change mentioned above. This will solve your problem.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文