我已经安装了一个模块扩展,它会抛出致命错误"致命错误:Class' Mage_Giftcards_Helper_Data'没有在.... / app / Mage.php第546行和#34;在管理员。
我已将此链接https://stackoverflow.com/a/9191286/2919940和此链接以及https://magento.stackexchange.com/a/7133/3693
引用但我有
<global>
<helpers>
<giftcards>
<class>Webtex_Giftcards_Helper</class>
</giftcards>
</helpers>
</global>
在我的config.xml中,我有这个类
class Webtex_Giftcards_Helper_Data extends Mage_Core_Helper_Data{
// my methods
}
在&#34; /app/code/local/Webtex/Giftcards/Helper/Data.php"路径。
我已经禁用了编译器并清除了缓存,方法是将空的&#34; var / cache&#34; 。目录
我发现config.xml应该有helper类定义,Data.php应该声明帮助类。
但在我的情况下,我有两个,这个错误的原因是什么?我已经在我的新magento安装上测试了该模块,
Magento版本是1.7.0.2
请提供此错误的帮助??如果有类名冲突,我们如何调试?
更新: 这是我的app / etc / modules / Webtex_Giftcards.xml文件。
<?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文件
<?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文件。
<?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>
由于
答案 0 :(得分:6)
我的答案与@Pedram Behroozi的答案非常相似,如果不是因为评论的声誉上有限制,我可能会将其添加为评论。
当我遇到这个问题时,是因为对adminhtml.xml中“module”属性的混淆。
<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不是完全正确。当您提供“translate”属性时,相应的“module”属性会告诉Magento该转换使用什么帮助器。因此,重要的是它与config.xml中 helpers 节点内的节点名称完全匹配。我错了,因为在那个节点中我已经包含了命名空间:
<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中的内容匹配即可。
答案 1 :(得分:2)
我遇到了这个错误两次,在这两种情况下我的xml文件都出现了问题。
我的问题不是关闭标签(例子):
<frontend>
<routers>
<!-- ... -->
<routers>
以错误的方式指定module
属性(在etc/adminhtml.xml
中):
<config>
<menu>
<report>
<children>
<foo_bar translate="title" module="bar"> <!-- module has to be lower case here and without the package name. Foo_Bar or Bar are wrong and cause the error. -->
<title>My own report</title>
<action>adminhtml/bar</action>
</foo_bar>
</children>
</report>
</menu>
</config>
请注意上面代码中的注释。
不幸的是,没有简单的方法可以检查xml文件是否存在拼写错误,但有一种方法是逐个注释掉代码并查看错误是否消失。
希望它有所帮助。
答案 2 :(得分:1)
请检查是否已从管理员启用编译&gt; “系统”&gt;工具&gt;汇编。如果您在不禁用编译的情况下添加了扩展名,则可能会导致此问题。清除缓存&amp;再次重新运行编译过程。希望这可以解决你的问题。
答案 3 :(得分:1)
在您的模块config.xml中,您必须定义Helpers节点,否则它将始终寻找Mage _...而不是Local或Community
<global>
<helpers>
<mymodulename><class>XXX_YYY_Helper</class>
</mymodulename>
</helpers>
</global>
答案 4 :(得分:0)
你的助手类应该是这样的,
class Webtex_Giftcards_Helper_Data extends Mage_Core_Helper_Abstract{
// my methods
}
检查您的扩展类.. 你应该从
扩展你的课程Mage_Core_Helper_Abstract
不是来自
Mage_Core_Helper_Data
答案 5 :(得分:0)
您忘记在前端节点中添加frontName
<frontend>
<routers>
<giftcards>
<use>standard</use>
<args>
<module>Webtex_Giftcards</module>
<frontName>giftcards</frontName>
</args>
</giftcards>
<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>
</frontend>
希望这能帮到你
答案 6 :(得分:0)
此错误是由自动加载器文件引起的。要解决它,请不要在文件名中使用“_”,特别是在config.xml中,它将替换为“/”并抛出此类错误。
例: giftcard_confirm.html
Insted使用: giftcardconfirm.html
答案 7 :(得分:0)
我有同样的问题。我检查了我的config.xml并检查了我的布局xml:
<layout> <updates> <module_name> <file>module_name.xml</file> </module_name> </updates> </layout>
I have done mistake in module_name.xml. I have remove that code which is not needed.