0

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

我怎样才能做到这一点?它是用 渲染的$this->renderTotals(null, $_colspan);,这给了我运费+子总计。我不知道从哪里开始。。

提前致谢

4

1 回答 1

1

这是我已经完成的一个实现。这是一个标准覆盖 (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;
    }
}
于 2012-02-22T03:06:05.787 回答