在magento的一个页面结帐中的审核订单页面上我想缩短“运费和处理(固定费率 - 固定)”文本(请参阅http://d.pr/AAlb)。 我希望它只是阅读“运输和处理”并删除括号中的承运人/交付类型
我该怎么做?它使用$this->renderTotals(null, $_colspan);
呈现,这为我提供了运费+小计。我不知道从哪里开始..
提前致谢
答案 0 :(得分:1)
这是我已经完成的实现。这是标准覆盖(http://inchoo.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;
}
}