我已经按照以下两个教程创建了一个自定义发货模块
http://techportal.inviqa.com/2011/06/09/creating-a-custom-magento-shipping-method/
http://www.magentocommerce.com/wiki/5_-_modules_and_development/shipping/create-shipping-method-module
我现在需要翻译发货方法的标题,但是,我得到了以下错误
Invalid method VMR_Shipping_Model_Carrier_Customrate::__(Array
(
[0] => Flat Rate: 3-10 Days
)
)
使用这行代码
$optionTitle = $this->__('Flat Rate: 3-10 Days');
非常感谢您的任何想法或意见!
发布于 2013-01-16 07:53:09
这是因为__()
函数是在核心块、核心控制器和核心助手的抽象类中定义的,而不是核心模型。通过设置一个扩展Mage_Core_Helper_Abstract
的帮助器并运行该函数,您可以轻松地翻译任何您想要的内容。
echo Mage::helper('vrm_shipping')->__('Flat Rate: 3-10 Days')
..。或者,如果你感到懒惰,那就让抽象的帮助器为你翻译
echo Mage::helper('core')->__('Flat Rate: 3-10 Days')
...However,我不确定您正在做什么的细节,但通常最好的做法是在块或模板中进行翻译。为什么不在输出发货方法的模板中调用__()
函数呢?
https://stackoverflow.com/questions/14348712
复制相似问题