The question:
I wrote a new extension and trying to create a configuration setting file in Magento Admin. When I run on browser after clearing the cache I got the error like below
Fatal error: Class 'Mage_GlobalSms_Helper_Data' not found in D:wampwwwprojectappMage.php on line 547
In system.log error log file I found the error below:
2015-05-27T13:40:43+00:00 ERR (3): Warning: include(MageGlobalSmsHelperData.php): failed to open stream: No such file or directory in D:wampwwwprojectlibVarienAutoload.php on line 93
2015-05-27T13:40:43+00:00 ERR (3): Warning: include(): Failed opening 'MageGlobalSmsHelperData.php' for inclusion (include_path='D:wampwwwprojectappcodelocal;D:wampwwwprojectappcodecommunity;D:wampwwwprojectappcodecore;D:wampwwwprojectlib;.;C:phppear') in D:wampwwwprojectlibVarienAutoload.php on line 93
My appetcmodules file as below:
<?xml version="1.0"?>
<config>
<modules>
<Php_GlobalSms>
<active>true</active>
<codePool>local</codePool>
<version>0.0.1</version>
</Php_GlobalSms>
</modules>
</config>
My config.xml as below:
<config>
<modules>
<Ucs_GlobalSms>
<version>0.0.1</version>
</Ucs_GlobalSms>
</modules>
<admin>
<routers>
<adminhtml>
<args>
<modules>
<ucs_globalsms before="Mage_Adminhtml">Ucs_GlobalSms_Adminhtml</ucs_globalsms>
</modules>
</args>
</adminhtml>
</routers>
</admin>
<global>
<helpers>
<globalsms>
<class>Ucs_GlobalSms_Helper</class>
</globalsms>
</helpers>
<models>
<custommodule>
<class>Ucs_GlobalSms_Model</class>
</custommodule>
</models>
<events>
<customer_register_success>
<observers>
<Ucs_GlobalSms_customer_register_success>
<type>singleton</type>
<class>Ucs_GlobalSms_Model_Observer</class>
<method>customerRegisterSuccess</method>
</Ucs_GlobalSms_customer_register_success>
</observers>
</customer_register_success>
</events>
</global>
My Helper/Data.php as below:
<?php
class Php_GlobalSms_Helper_Data extends Mage_Core_Helper_Abstract {
}
I can find lot of posts on SO saying that Data.php is missing, but everything is there, still I am getting error
The Solutions:
Below are the methods you can try. The first solution is probably the best. Try others if the first one doesn’t work. Senior developers aren’t just copying/pasting – they read the methods carefully & apply them wisely to each case.
Method 1
Your helpers declaration should look like this:
<global>
<helpers>
<globalsms>
<class>Php_GlobalSms_Helper</class>
</globalsms>
</helpers>
</global>
and you should call your helper in the code like this:
Mage::helper('globalsms');
Method 2
Your module name in module.xml
is different in config.xml
.
I’m not sure myself what you want to use, Php_GlobalSms
or Ucs_GlobalSms
?
Method 3
If you enable compilation (System > Tools > Compilation), you need to disable or re-compile it. It is the best that you disable Compilation when you do development.
Method 4
You need to define your helper in the config.xml
<config>
<modules>
<Php_GlobalSms>
<version>0.0.1</version>
</Php_GlobalSms>
</modules>
<admin>
<routers>
<adminhtml>
<args>
<modules>
<ucs_globalsms before="Mage_Adminhtml">Php_GlobalSms_Adminhtml</ucs_globalsms>
</modules>
</args>
</adminhtml>
</routers>
</admin>
<global>
<models>
<custommodule>
<class>Php_GlobalSms_Model</class>
</custommodule>
</models>
<helpers>
<globalsms>
<class>Php_GlobalSms_Helper</class>
</globalsms>
</helpers>
<events>
<customer_register_success>
<observers>
<Php_GlobalSms_customer_register_success>
<type>singleton</type>
<class>Php_GlobalSms_Model_Observer</class>
<method>customerRegisterSuccess</method>
</Php_GlobalSms_customer_register_success>
</observers>
</customer_register_success>
</events>
</global>
Method 5
You said that you created a configuration setting for the admin area; in the system.xml-file, I assume you have something like this (you should have):
<php_globalsms_options translate="label" module="php_globalsms">[...]
This is where Magento tries to load your helper: it handles the translation, regardless of the fact if you call the helper in any of your files or not. The other answers tell the correct way: update your config.xml file and tell Magento that the GlobalSms-helper resides in your module.
Method 6
I have same problem. I have check my config.xml and check my layout 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.
All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0