Home » Magento11 April 2011

Magento: Helper Data not found error

I created a module, let’s say, ‘MyModule’. When I go to the Admin -> System -> Configuration section of this module, I get this weird error.

Fatal error: Class ‘Mage_MyModule_Helper_Data’ not found

– My Module is enabled.
– I have helper class in ‘Helper’ folder of my module.
– I have deleted/refreshed all cache and session.

According to my findings, the problem should be in XML file. Either the XML file inside app/etc/modules or the XML file inside MyNamespace/MyModule/etc.

1) XML is strictly case sensitive

I opened app/etc/modules/MyNamespace_MyModule.xml to check the case sensitive issue as the XML files are strictly case sensitive.

Everything was okay with it. Here is the code:-

I was checking the codePool node. You might get this error if you write codepool (all small letters) instead of codePool (P capital). However, in my case, it was okay.

2) XML doesn’t ignore whitespace (even if it is commented)

This was the main cause of the error in my case. You should not keep space in between XML content. I had kept space in MyNamespace/MyModule/etc/config.xml

The tricky part is that the space was inside commented XML code. Didn’t know that XML checks for whitespace inside commented code as well.

I have commented out some code in config.xml as below:-

The space just after the comment start (before default node) and the space just before the comment end (after closing default node) was causing the error. I deleted the whole commented code and my problem was solved. :)

Hope this helps. Thanks.

Magento

Get New Post by Email

Find me on

FacebookTwitterGoogle+LinkedInRSS Feed
  • Sonia

    Hi mukesh

    Your articles are very good and they helped me many times while developing an online store with magento. Now i am stuck with a problem,ie, after the billing step before place an order button i am getting this error:
    Call to a member function setTitle() on a non-object in app/code/core/Mage/Customer/Block/Form/Login.php

    Can you tell me a solution- either wots the problem with or how to suppress this error

  • Ken

    Hey Mukesh

    The article is nice. I got the same error message. However, I followed your tips and double checked all spaces that may cause the problem, but I got no luck. The problem is still there. Is there any thing else could cause that error that you can think of?

    Thanks.
    Ken

  • Excellent article, I had same trouble i checked spacing and all but still troubling me, Any other probability..   

  • Dushyant Joshi

    The Perfect Answer :)

  • still having the same problem. Double checked my config.xml, Company_Module.xml and spellings.