This is common when referencing a missing helper. In many cases the class name itself is malformed or your shortname referencing it is incorrect, which is why Magento is looking for it in the path Mage_Giftcards_Helper_Data
(see example 1 below). For the following examples I have set up a module called MyCompany_MyModule
.
These are just a few of the many ways you can go awry with defining helpers:
Incorrect helper class alias:
I reference my helper as:
$helper = Mage::helper('mycompany');
I get the error:
Fatal error: Class 'Mage_Mycompany_Helper_Data' not found
What went wrong?
My helper class alias is defined as mymodule
:
<helpers>
<mymodule>
<class>MyCompany_MyModule_Helper</class>
</mymodule>
</helpers>
Changing my shortcode to Mage::helper('mymodule')
produced the desired result.
Malformed class name
I reference my helper (correctly this time):
$helper = Mage::helper('mymodule');
I receive:
Fatal error: Class 'MyCompany_MyModule_Helper_Data' not found
What went wrong?
My class definition was missing "_Data":
class MyCompany_MyModule_Helper extends Mage_Core_Helper_Abstract
{
}
Helper/Custom:
This is similar to what happens when you try to refer to a helper class within a file not named "Data.php".
I reference my helper as:
$helper = Mage::helper('custom');
My module helper path was defined as:
<helpers>
<mymodule>
<class>MyCompany_MyModule_Helper</class>
</mymodule>
</helpers>
I have a class file in app/code/local/MyCompany/MyModule/Helper/Custom.php
I get the error:
Fatal error: Class 'Mage_Custom_Helper_Data' not found
What went wrong?
You need to specify other helper classes in a particular module as sub-paths to your module helper's shortname. This is similar to how blocks and models work - but at the topmost level there is no subfolder.
I fix this error by referencing my Custom.php helper class file as such:
$helper = Mage::helper('mymodule/custom');
You configured your helper class like this.
<helpers>
<rms>
<class>NewHope_Rms_Helper</class>
</rms>
</helpers>
So when you request you helper class with Mage::helper('rms')
, Magento will trace your module, since it defines the helper alias name rms
and then pick class name associate with it. So in this case, Magento has NewHope_Rms_Helper
. The next step magento checks, whether you requested in particular helper class name. For example, if you were requested a helper class like Mage::helper(rms/example)
, then magento will append this example
part to the class that already picked from your configuration and thus completes the class generation process(Here the class would be NewHope_Rms_Helper_Example
). However if we didn't specify any specific helper name, then by default, Magento assumes this class name as Data
. So in your case, Magento forms final helper class as NewHope_Rms_Helper_Data
.
The name of the class is an indication to the location where that class should be defined. That means Magento will now look for your helper in app/code/local/NewHope/Rms/Helper/Data.php
. If it is not present there, it will look in app/code/community/NewHope/Rms/Helper/Data.php
. Then again in app/code/core
directory and then again in lib
directory. In your case, Magento can't find the helper class. So as a result it will throw an error.(Note location generated is NewHope\Rms
and not NewHope\RmsUpdate
).
So the configuration that you need here is
<helpers>
<rms>
<class>NewHope_RmsUpdate_Helper</class>
</rms>
</helpers>
So this will generate a class NewHope_RmsUpdate_Helper_Data
and thus first it will look in the location app/code/local/NewHope/RmsUpdate/Helper/Data.php
. The file content should look like this.
<?php
class NewHope_RmsUpdate_Helper_Data extends Mage_Core_Helper_Abstract
{
}
Hope that will give you an idea on what is really happens in the backside
Best Answer
I found out the solution to my problem. I renamed the file in app/code/local/Megnor/Framework/etc/adminhtml.xml to admin.xml and it works now. This thread on magentocommerce helped me out http://www.magentocommerce.com/boards/viewthread/354259/.
Thanks.