自定义评论页面总计文本(运输和处理(统一费率 - 固定))

发布于 2025-01-07 20:23:59 字数 260 浏览 3 评论 0原文

在magento单页结帐的审核订单页面上,我想缩短“运输和处理(固定费率 - 固定)”文本(请参阅http://d.pr/AAlb)。 我希望它只是阅读“运输和处理”并删除括号中写的承运人/交付类型

我该怎么做?它是用 $this->renderTotals(null, $_colspan); 渲染的,这给了我运费+小计。我不知道从哪里开始。

On the review order page in onepage checkout in magento I want to shorten the "Shipping & Handling (Flat Rate - Fixed)" text (see http://d.pr/AAlb).
I want it to just read "Shipping & Handling" and remove the carrier/delivery type written in brackets

How can I do that? It's rendered with $this->renderTotals(null, $_colspan);, which gives me shipping cost+sub total. I don't know where to start from here.

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

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

发布评论

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

评论(1

枫林﹌晚霞¤ 2025-01-14 20:23:59

这是我所做的一个实现。这是标准覆盖(http://inhoo.net/ecommerce/magento/how_to_override_magento_model_classes/)。我这样做是为了不太深入到最重要的系统。

class Your_Company_Model_Address_Total_Shipping extends Mage_Sales_Model_Quote_Address_Total_Shipping
{

    /**
     * Collect totals information about shipping
     *
     * @param   Mage_Sales_Model_Quote_Address $address
     * @return  Mage_Sales_Model_Quote_Address_Total_Shipping
     */
    public function collect(Mage_Sales_Model_Quote_Address $address)
    {
        parent::collect($address);

        $method = $address->getShippingMethod();

        if ($method) {
            foreach ($address->getAllShippingRates() as $rate) {
                if ($rate->getCode()==$method) {
                    $shippingDescription = $rate->getMethodTitle();
                    if (stripos($shippingDescription, ",") > -1)
                        $shippingDescription = substr($shippingDescription, 0, stripos($shippingDescription, ","));
                    $address->setShippingDescription(trim($shippingDescription, ' -'));
                    break;
                }
            }
        }

        return $this;
    }
}

Here is an implementation that I have done. This is a standard override (http://inchoo.net/ecommerce/magento/how_to_override_magento_model_classes/). I did it this way so as to not get too deep into the overriding system.

class Your_Company_Model_Address_Total_Shipping extends Mage_Sales_Model_Quote_Address_Total_Shipping
{

    /**
     * Collect totals information about shipping
     *
     * @param   Mage_Sales_Model_Quote_Address $address
     * @return  Mage_Sales_Model_Quote_Address_Total_Shipping
     */
    public function collect(Mage_Sales_Model_Quote_Address $address)
    {
        parent::collect($address);

        $method = $address->getShippingMethod();

        if ($method) {
            foreach ($address->getAllShippingRates() as $rate) {
                if ($rate->getCode()==$method) {
                    $shippingDescription = $rate->getMethodTitle();
                    if (stripos($shippingDescription, ",") > -1)
                        $shippingDescription = substr($shippingDescription, 0, stripos($shippingDescription, ","));
                    $address->setShippingDescription(trim($shippingDescription, ' -'));
                    break;
                }
            }
        }

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