我安装了一个模块扩展,它在管理员中抛出一个 fatal error “ fatal error :类‘Mage_Giftcards_Helper_Data’在 ..../app/Mage.php 中找不到,第 546 行”。
我已提交此链接 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
}
在“/app/code/local/Webtex/Giftcards/Helper/Data.php”路径中声明。
我禁用了编译器并通过创建空的“var/cache”目录清除了缓存。
我到处都发现 config.xml 应该定义辅助类,而 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>
谢谢
最佳答案
我的回答与@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 说模块名称必须小写且没有 namespace 时,他完全是不正确的。当您提供“翻译”属性时,相应的“模块”属性会告诉 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 中的内容相匹配。
关于php - Magento : Fatal error: Class 'Mage_Giftcards_Helper_Data' not found in . ..../app/Mage.php 第 546 行,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19590164/
我正在尝试测试是否存在表单。我是Rails新手。我的new.html.erb_spec.rb文件的内容是:require'spec_helper'describe"messages/new.html.erb"doit"shouldrendertheform"dorender'/messages/new.html.erb'reponse.shouldhave_form_putting_to(@message)with_submit_buttonendendView本身,new.html.erb,有代码:当我运行rspec时,它失败了:1)messages/new.html.erbshou
我在我的项目目录中完成了compasscreate.和compassinitrails。几个问题:我已将我的.sass文件放在public/stylesheets中。这是放置它们的正确位置吗?当我运行compasswatch时,它不会自动编译这些.sass文件。我必须手动指定文件:compasswatchpublic/stylesheets/myfile.sass等。如何让它自动运行?文件ie.css、print.css和screen.css已放在stylesheets/compiled。如何在编译后不让它们重新出现的情况下删除它们?我自己编译的.sass文件编译成compiled/t
我在我的项目中添加了一个系统来重置用户密码并通过电子邮件将密码发送给他,以防他忘记密码。昨天它运行良好(当我实现它时)。当我今天尝试启动服务器时,出现以下错误。=>BootingWEBrick=>Rails3.2.1applicationstartingindevelopmentonhttp://0.0.0.0:3000=>Callwith-dtodetach=>Ctrl-CtoshutdownserverExiting/Users/vinayshenoy/.rvm/gems/ruby-1.9.3-p0/gems/actionmailer-3.2.1/lib/action_mailer
在MRIRuby中我可以这样做:deftransferinternal_server=self.init_serverpid=forkdointernal_server.runend#Maketheserverprocessrunindependently.Process.detach(pid)internal_client=self.init_client#Dootherstuffwithconnectingtointernal_server...internal_client.post('somedata')ensure#KillserverProcess.kill('KILL',
我已经从我的命令行中获得了一切,所以我可以运行rubymyfile并且它可以正常工作。但是当我尝试从sublime中运行它时,我得到了undefinedmethod`require_relative'formain:Object有人知道我的sublime设置中缺少什么吗?我正在使用OSX并安装了rvm。 最佳答案 或者,您可以只使用“require”,它应该可以正常工作。我认为“require_relative”仅适用于ruby1.9+ 关于ruby-主要:Objectwhenrun
我花了三天的时间用头撞墙,试图弄清楚为什么简单的“rake”不能通过我的规范文件。如果您遇到这种情况:任何文件夹路径中都不要有空格!。严重地。事实上,从现在开始,您命名的任何内容都没有空格。这是我的控制台输出:(在/Users/*****/Desktop/LearningRuby/learn_ruby)$rake/Users/*******/Desktop/LearningRuby/learn_ruby/00_hello/hello_spec.rb:116:in`require':cannotloadsuchfile--hello(LoadError) 最佳
我注意到像bundler这样的项目在每个specfile中执行requirespec_helper我还注意到rspec使用选项--require,它允许您在引导rspec时要求一个文件。您还可以将其添加到.rspec文件中,因此只要您运行不带参数的rspec就会添加它。使用上述方法有什么缺点可以解释为什么像bundler这样的项目选择在每个规范文件中都需要spec_helper吗? 最佳答案 我不在Bundler上工作,所以我不能直接谈论他们的做法。并非所有项目都checkin.rspec文件。原因是这个文件,通常按照当前的惯例,只
我已经像这样安装了一个新的Rails项目:$railsnewsite它执行并到达:bundleinstall但是当它似乎尝试安装依赖项时我得到了这个错误Gem::Ext::BuildError:ERROR:Failedtobuildgemnativeextension./System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/rubyextconf.rbcheckingforlibkern/OSAtomic.h...yescreatingMakefilemake"DESTDIR="cleanmake"DESTDIR="
关闭。这个问题需要detailsorclarity.它目前不接受答案。想改进这个问题吗?通过editingthispost添加细节并澄清问题.关闭8年前。Improvethisquestion在首页我有:汽车:VolvoSaabMercedesAudistatic_pages_spec.rb中的测试代码:it"shouldhavetherightselect"dovisithome_pathit{shouldhave_select('cars',:options=>['volvo','saab','mercedes','audi'])}end响应是rspec./spec/request
似乎无法为此找到有效的答案。我正在阅读Rails教程的第10章第10.1.2节,但似乎无法使邮件程序预览正常工作。我发现处理错误的所有答案都与教程的不同部分相关,我假设我犯的错误正盯着我的脸。我已经完成并将教程中的代码复制/粘贴到相关文件中,但到目前为止,我还看不出我输入的内容与教程中的内容有什么区别。到目前为止,建议是在函数定义中添加或删除参数user,但这并没有解决问题。触发错误的url是http://localhost:3000/rails/mailers/user_mailer/account_activation.http://localhost:3000/rails/mai