【问题标题】:Magento custom shipping module translationsMagento 定制运输模块翻译
【发布时间】:2013-10-15 08:07:21
【问题描述】:

我创建了一个正在运行的自定义运输模块。 我想将结帐页面上显示的 2 个文本设置为来自翻译文件。

config.xml

<default>
    <carriers>
      <starmall>
           <active>1</active>
           <model>Starmall_Shippingcost_Model_Carrier_Starmall</model>
           <title>Carrier Title</title>
           <name>Method Name</name>
           <price>0.00</price>
           <specificerrmsg>This shipping method is currently unavailable. If you would like to ship using this shipping method, please contact us.</specificerrmsg>
        </starmall>
     </carriers>
</default>

管理界面:

结帐前端屏幕:

问题:我想将代码中的“aaa”和“bbb”文本设置为来自翻译文件。

我可以使用
$method-&gt;setMethodTitle(Mage::helper("starmall_config")-&gt;__("Starmall_shipping_method_title"));在代码中设置“aaa”文本

然后显示:

如何在代码中设置“bbb”文本?

以下不起作用:

        $method->setCarrierTitle("xxxxxx");
        $method->setTitle("xxxxx");

【问题讨论】:

  • 作为替代方式,您可以设置商店明智的标题和方法名称,从左侧下拉列表中选择您的商店并按商店添加新标题。

标签: magento magento-1.7


【解决方案1】:

可以使用翻译功能!

    $method->setCarrierTitle( Mage::helper('core')->__('string1') );
    $method->setTitle(Mage::helper('core')->__('string2'));

然后将此字符串添加到您的翻译 CSV 文件中!

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2013-10-18
    • 2022-08-24
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-12-07
    相关资源
    最近更新 更多