且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

Magento:致命错误:在行546上的...../app/Mage.php中找不到类'Mage_Giftcards_Helper_Data'

更新时间:2023-11-30 10:35:52

我的答案与@Pedram Behroozi的答案非常相似,如果不是出于对注释的奇怪声誉限制的考虑,我可能已将其添加为注释.

My answer is quite similar to that of @Pedram Behroozi, I might have added it as a comment if it wasn't for the strange reputation limit on comments.

当我遇到这个问题时,是因为对adminhtml.xml中的"module"属性感到困惑.

When I had this problem, it was because of confusion over the "module" attribute in adminhtml.xml.

<config>
  <menu>
    <catalog>
      <children>
        <productfeed translate="title" module="productfeed">
          <title>Product Data Feed</title>
          <action>adminhtml/productfeed/</action>
          <sort_order>90</sort_order>
        </productfeed>
      </children>
    </catalog>
  </menu>
</config>

Pedram说模块名称必须是小写且没有名称空间时,不完全是不正确的.当您提供翻译"属性时,相应的模块"属性就会告诉Magento该翻译使用什么助手.因此,重要的是它与config.xml中 helpers 节点内的节点名称完全匹配.我的想法是错误的,因为在该节点中我包含了名称空间:

Pedram is not exactly correct when he says the module name has to be lower case and without the namespace. When you provide a "translate" attribute then the corresponding "module" attribute is telling Magento what helper to use for that translation. So, what matters is that it exactly matches the node name inside the helpers node in config.xml. Mine was wrong because in that node I had included the namespace:

<config>
  <global>
    <helpers>
      <etw_productfeed>
        <class>Etw_Productfeed_Helper</class>
      </etw_productfeed>
    </helpers>
  </global>
</config>

在Alan Storm的文章"Admin Hello World Revisited" 中,您可以看到他在模块引用中使用了命名空间,并且仍然可以使用.因此,只要adminhtml.xml中的内容与config.xml中的内容匹配,两种方法都可以.

In Alan Storm's article "Admin Hello World Revisited" you can see he uses the namespace in his module references, and that still works. So either way is fine, as long as what's in adminhtml.xml matches what's in config.xml.