Magento:致命错误:在行546上的...../app/Mage.php中找不到类'Mage_Giftcards_Helper_Data' [英] Magento : Fatal error: Class 'Mage_Giftcards_Helper_Data' not found in ...../app/Mage.php on line 546

查看:61
本文介绍了Magento:致命错误:在行546上的...../app/Mage.php中找不到类'Mage_Giftcards_Helper_Data'的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经安装了一个模块扩展,该扩展引发了致命错误:致命错误:在第546行的..../app/Mage.php中找不到类'Mage_Giftcards_Helper_Data'".

I have installed one module extension which throws an fatal error "Fatal error: Class 'Mage_Giftcards_Helper_Data' not found in ..../app/Mage.php on line 546" in admin.

我已经引用了此链接 https://stackoverflow.com/a/9191286/2919940 https://magento.stackexchange.com/a/7133/3693

I have reffered this link https://stackoverflow.com/a/9191286/2919940 and this link as well https://magento.stackexchange.com/a/7133/3693

但是我有

<global>
<helpers>
        <giftcards>
            <class>Webtex_Giftcards_Helper</class>
        </giftcards>
    </helpers>
</global>

在我的config.xml中,我有此类

in my config.xml and I have this class

class Webtex_Giftcards_Helper_Data extends Mage_Core_Helper_Data{
// my methods
}

在"/app/code/local/Webtex/Giftcards/Helper/Data.php"路径中声明.

declared at "/app/code/local/Webtex/Giftcards/Helper/Data.php" path.

我已禁用编译器,并通过创建空的"var/cache"目录来清除缓存.

I have disabled compiler and cleared cache by making empty "var/cache" directory.

我发现config.xml应该定义了助手类,而Data.php应该声明了该助手类.

I found everwhere that config.xml should have helper class define and Data.php should have declare that helper class.

但是我两个人都有,这个错误的原因是什么?我也在新的magento安装上测试了该模块,

But I have both of them in my case, what can be reason for this error ? I have tested that module on my fresh magento installation as well,

Magento版本是1.7.0.2

Magento version is 1.7.0.2

请为该错误提供帮助?如果类名存在冲突,我们该如何调试??

Please provide help for this error ?? If there's conflicts of class names how can we debug that ??

更新: 这是我的app/etc/modules/Webtex_Giftcards.xml文件.

UPDATE: Here is my app/etc/modules/Webtex_Giftcards.xml file.

<?xml version="1.0"?>
<config>
    <modules>
        <Webtex_Giftcards>
        <active>true</active>
        <codePool>local</codePool>
        <name>Webtex Gift Cards</name>
    </Webtex_Giftcards>
</modules>
</config>

这是我的system.xml文件

And here is my system.xml file

<?xml version="1.0"?>
<config>
<tabs>
    <webtex translate="label" module="giftcards">
        <label>WebTex</label>
        <sort_order>300</sort_order>
    </webtex>
</tabs>
<sections>
    <giftcards module="giftcards">
        <tab>webtex</tab>
        <label>Gift Cards</label>
        <frontend_type>text</frontend_type>
        <sort_order>200</sort_order>
        <show_in_default>1</show_in_default>
        <show_in_website>1</show_in_website>
        <show_in_store>1</show_in_store>
        <groups>
            <default module="giftcards">
                <label>Defaults</label>
                <frontend_type>text</frontend_type>
                <sort_order>10</sort_order>
                <show_in_default>1</show_in_default>
                <show_in_website>1</show_in_website>
                <show_in_store>1</show_in_store>
                <fields>
                    <min_card_value>
                        <label>Min Gift Card Value</label>
                        <frontend_type>text</frontend_type>
                        <sort_order>20</sort_order>
                        <show_in_default>1</show_in_default>
                        <show_in_website>1</show_in_website>
                        <show_in_store>1</show_in_store>
                    </min_card_value>
                    <max_card_value>
                        <label>Max Gift Card Value</label>
                        <frontend_type>text</frontend_type>
                        <sort_order>21</sort_order>
                        <show_in_default>1</show_in_default>
                        <show_in_website>1</show_in_website>
                        <show_in_store>1</show_in_store>
                    </max_card_value>
                    <show_in_shopping_cart>
                        <label>Show In Shopping Cart Page</label>
                        <frontend_type>select</frontend_type>
                        <source_model>adminhtml/system_config_source_yesno</source_model>
                        <sort_order>22</sort_order>
                        <show_in_default>1</show_in_default>
                        <show_in_website>1</show_in_website>
                        <show_in_store>1</show_in_store>
                    </show_in_shopping_cart>
                    <show_as_payment_method>
                        <label>Show As Payment Method</label>
                        <frontend_type>select</frontend_type>
                        <source_model>adminhtml/system_config_source_yesno</source_model>
                        <sort_order>22</sort_order>
                        <show_in_default>1</show_in_default>
                        <show_in_website>1</show_in_website>
                        <show_in_store>1</show_in_store>
                    </show_as_payment_method>
                    <show_mail_delivery_date_field>
                        <label>Show email delivery date field</label>
                        <frontend_type>select</frontend_type>
                        <source_model>adminhtml/system_config_source_yesno</source_model>
                        <sort_order>23</sort_order>
                        <show_in_default>1</show_in_default>
                        <show_in_website>1</show_in_website>
                        <show_in_store>1</show_in_store>
                    </show_mail_delivery_date_field>
                </fields>
            </default>
            <email module="giftcards">
                <label>Email Options</label>
                <frontend_type>text</frontend_type>
                <sort_order>50</sort_order>
                <show_in_default>1</show_in_default>
                <show_in_website>1</show_in_website>
                <show_in_store>1</show_in_store>
                <fields>
                    <card_picture>
                        <label>Use default GiftCard picture for Email</label>
                        <frontend_type>select</frontend_type>
                    <source_model>adminhtml/system_config_source_yesno</source_model>
                        <sort_order>24</sort_order>
                        <show_in_default>1</show_in_default>
                        <show_in_website>1</show_in_website>
                        <show_in_store>1</show_in_store>
                        <comment>Set "No" for use product picture</comment>
                    </card_picture>
                    <email_template>
                        <label>Template for e-mail</label>
                        <frontend_type>select</frontend_type>
                        <source_model>adminhtml/system_config_source_email_template</source_model>
                        <sort_order>30</sort_order>
                        <show_in_default>1</show_in_default>
                        <show_in_website>1</show_in_website>
                        <show_in_store>1</show_in_store>
                    </email_template>
                    <print_template>
                        <label>Template for print</label>
                        <frontend_type>select</frontend_type>
                        <source_model>adminhtml/system_config_source_email_template</source_model>
                        <sort_order>30</sort_order>
                        <show_in_default>1</show_in_default>
                        <show_in_website>1</show_in_website>
                        <show_in_store>1</show_in_store>
                    </print_template>
                    <offline_template>
                        <label>Template for offline</label>
                        <frontend_type>select</frontend_type>
                        <source_model>adminhtml/system_config_source_email_template</source_model>
                        <sort_order>30</sort_order>
                        <show_in_default>1</show_in_default>
                        <show_in_website>1</show_in_website>
                        <show_in_store>1</show_in_store>
                    </offline_template>
                    <confirm_template>
                        <label>Template for confirmation</label>
                        <frontend_type>select</frontend_type>
                        <source_model>adminhtml/system_config_source_email_template</source_model>
                        <sort_order>30</sort_order>
                        <show_in_default>1</show_in_default>
                        <show_in_website>1</show_in_website>
                        <show_in_store>1</show_in_store>
                    </confirm_template>
                </fields>
            </email>
        </groups>
    </giftcards>
</sections>
</config>

这是我的config.xml文件.

And Here is my config.xml file.

<?xml version="1.0"?>
<config>
<modules>
    <Webtex_Giftcards>
        <version>3.3.1</version>
    </Webtex_Giftcards>
</modules>
<admin>
    <routers>
        <giftcards>
            <use>admin</use>
            <args>
                <module>Webtex_Giftcards</module>
                <frontName>giftcards</frontName>
            </args>
        </giftcards>
        <adminhtml>
            <args>
                <modules>
                    <Webtex_Giftcards before="Mage_Adminhtml">Webtex_Giftcards_Adminhtml</Webtex_Giftcards>
                </modules>
            </args>
        </adminhtml>
    </routers>
</admin>
<frontend>
    <routers>
        <checkout>
            <args>
                <modules>
                    <Webtex_Giftcards before="Mage_Checkout">Webtex_Giftcards</Webtex_Giftcards>
                </modules>
            </args>
        </checkout>
    </routers>
    <layout>
        <updates>
            <giftcards>
                <file>giftcards.xml</file>
            </giftcards>
        </updates>
    </layout>
    <translate>
        <modules>
            <Webtex_Giftcards>
                <files>
                    <default>Webtex_Giftcards.csv</default>
                </files>
            </Webtex_Giftcards>
        </modules>
    </translate>
</frontend>
<global>
    <rewrite>
        <giftcards_giftcards_index>
            <from><![CDATA[#^/customer/giftcards/#]]></from>
            <to>/giftcards/giftcards/</to>
        </giftcards_giftcards_index>
        <giftcards_giftcards_balance>
            <from><![CDATA[#^/customer/giftcards/balance/#]]></from>
            <to>/giftcards/giftcards/balance/</to>
        </giftcards_giftcards_balance>
        <giftcards_giftcards_print>
            <from><![CDATA[#^/customer/giftcards/print/#]]></from>
            <to>/giftcards/giftcards/print/</to>
        </giftcards_giftcards_print>
        <giftcards_giftcards_apply>
            <from><![CDATA[#^/customer/giftcards/apply/#]]></from>
            <to>/giftcards/giftcards/apply/</to>
        </giftcards_giftcards_apply>
    </rewrite>
    <models>
        <giftcards>
            <class>Webtex_Giftcards_Model</class>
            <resourceModel>giftcards_mysql4</resourceModel>
        </giftcards>
        <giftcards_mysql4>
            <class>Webtex_Giftcards_Model_Mysql4</class>
            <entities>
                <giftcards>
                    <table>giftcards_card</table>
                </giftcards>
                <cardslist>
                    <table>giftcards_cardlist</table>
                </cardslist>
                <order>
                    <table>giftcard_order</table>
                </order>
            </entities>
        </giftcards_mysql4>
        <sales>
            <rewrite>
                <order>Webtex_Giftcards_Model_Sales_Order</order>
            </rewrite>
        </sales>
    </models>
    <resources>
        <giftcards_setup>
            <setup>
                <module>Webtex_Giftcards</module>
                <class>Mage_Catalog_Model_Resource_Eav_Mysql4_Setup</class>
            </setup>
            <connection>
                <use>core_setup</use>
            </connection>
        </giftcards_setup>
    </resources>
    <helpers>
        <giftcards>
            <class>Webtex_Giftcards_Helper</class>
        </giftcards>
    </helpers>
    <blocks>
        <giftcards>
            <class>Webtex_Giftcards_Block</class>
        </giftcards>
    </blocks>
    <events>
        <catalog_product_save_before>
            <observers>
                <webtex_giftcards_observer_catalog_product_save_after>
                    <type>singleton</type>
                    <class>giftcards/observer</class>
                    <method>catalogProductSaveBefore</method>
                </webtex_giftcards_observer_catalog_product_save_after>
            </observers>
        </catalog_product_save_before>
        <order_cancel_after>
            <observers>
                <webtex_giftcards_observer_sales_order_cancel_after>
                    <type>singleton</type>
                    <class>giftcards/observer</class>
                    <method>salesOrderCancelAfter</method>
                </webtex_giftcards_observer_sales_order_cancel_after>
            </observers>
        </order_cancel_after>
        <sales_order_payment_refund>
            <observers>
                <webtex_giftcards_observer_sales_order_creditmemo_refund>
                    <type>singleton</type>
                    <class>giftcards/observer</class>
                    <method>saleOrderPaymentRefund</method>
                </webtex_giftcards_observer_sales_order_creditmemo_refund>
            </observers>
        </sales_order_payment_refund>
        <sales_order_save_after>
            <observers>
                <webtex_giftcards_observer_sales_order_save_after>
                    <type>singleton</type>
                    <class>giftcards/observer</class>
                    <method>salesOrderSaveAfter</method>
                </webtex_giftcards_observer_sales_order_save_after>
            </observers>
        </sales_order_save_after>


        <sales_model_service_quote_submit_after>
            <observers>
                <webtex_giftcards_observer_checkout_type_onepage_save_order_after>
                    <type>singleton</type>
                    <class>giftcards/observer</class>
                    <method>checkoutTypeOnepageSaveOrderAfter</method>
                </webtex_giftcards_observer_checkout_type_onepage_save_order_after>
            </observers>
        </sales_model_service_quote_submit_after>

        <core_block_abstract_to_html_after>
            <observers>
                <webtex_giftcards_observer_checkpriceiszero>
                    <type>singleton</type>
                    <class>giftcards/observer</class>
                    <method>checkpriceiszero</method>
                </webtex_giftcards_observer_checkpriceiszero>
            </observers>
        </core_block_abstract_to_html_after>
        <sales_quote_collect_totals_after>
            <observers>
                <webtex_giftcards_discount_observer_testdiscountquote>
                    <type>singleton</type>
                    <class>giftcards/discount_observer</class>
                    <method>testDiscountQuote</method>
                </webtex_giftcards_discount_observer_testdiscountquote>
            </observers>
        </sales_quote_collect_totals_after>
    </events>
    <template>
        <email>
            <giftcards_email_email_template translate="label" module="giftcards">
                <label>Gift Card E-mail</label>
                <file>giftcard_email.html</file>
                <type>html</type>
            </giftcards_email_email_template>
            <giftcards_email_print_template translate="label" module="giftcards">
                <label>Gift Card Print</label>
                <file>giftcard_print.html</file>
                <type>html</type>
            </giftcards_email_print_template>
            <giftcards_email_offline_template translate="label" module="giftcards">
                <label>Gift Card Offline</label>
                <file>giftcard_offline.html</file>
                <type>html</type>
            </giftcards_email_offline_template>
            <giftcards_email_confirm_template translate="label" module="giftcards">
                <label>Gift Card Confirm</label>
                <file>giftcard_confirm.html</file>
                <type>html</type>
            </giftcards_email_confirm_template>
        </email>
    </template>
    <catalog>
        <product>
            <type>
                <giftcards module="giftcards">
                    <label>Gift Card</label>
                    <model>giftcards/product_type_giftcards</model> 
                    <price_model>giftcards/product_price</price_model>
                    <is_qty>1</is_qty>
                    <composite>0</composite>
                </giftcards>
            </type>
        </product>
    </catalog>
    <sales>
        <quote>
            <totals>
                <discount>
                    <class>giftcards/discount</class>
                    <after>subtotal,shipping</after>
                    <before>grand_total</before>
                </discount>
            </totals>
        </quote>
    </sales>
</global>
<adminhtml>
    <sales>
        <order>
            <create>
                <available_product_types>
                    <giftcards />
                </available_product_types>
            </create>
        </order>
    </sales>
</adminhtml>
<default>
    <giftcards>
        <email>
            <email_template>giftcards_email_email_template</email_template>
            <print_template>giftcards_email_print_template</print_template>
            <offline_template>giftcards_email_offline_template</offline_template>
            <confirm_template>giftcards_email_confirm_template</confirm_template>
        </email>
    </giftcards>
</default>
<adminhtml><layout><updates><blog><file>webtex/giftcards/giftcards.xml</file></blog></updates></layout></adminhtml>
<crontabs>
    <jobs>
        <schedule><cron_expr>0 1 * * *</cron_expr></schedule>
        <run><model>giftcards/observer::sendEmailByDeliveryDate</model></run>
    </jobs>
</crontabs>
</config>

谢谢

推荐答案

我的答案与@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.

这篇关于Magento:致命错误:在行546上的...../app/Mage.php中找不到类'Mage_Giftcards_Helper_Data'的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆