Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Magento : Fatal error: Class 'Mage_Giftcards_Helper_Data' not found in ...../app/Mage.php on line 546

Tags:

php

magento

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.

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

But I have

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

in my config.xml and I have this class

class Webtex_Giftcards_Helper_Data extends Mage_Core_Helper_Data{
// my methods
}

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

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

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

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 version is 1.7.0.2

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

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>

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>

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>

Thanks

like image 832
Mukund Thanki Avatar asked Dec 26 '22 18:12

Mukund Thanki


1 Answers

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.

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 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>

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.

like image 162
Doug McLean Avatar answered May 07 '23 10:05

Doug McLean