helper_data.php not found in custom module
-
03-10-2020 - |
Question
I have created a new module. But it is showing error on log file like following:
2016-09-23T06:03:35+00:00 ERR (3): Warning: include(/home/andropls/magento/includes/src/Envato_Custompaymentmethod_Helper_Data.php): failed to open stream: No such file or directory in /home/andropls/magento/includes/src/Varien_Autoload.php on line 94
2016-09-23T06:03:35+00:00 ERR (3): Warning: include(/home/andropls/magento/includes/src/Envato_Custompaymentmethod_Helper_Data.php): failed to open stream: No such file or directory in /home/andropls/magento/includes/src/Varien_Autoload.php on line 94
2016-09-23T06:03:35+00:00 ERR (3): Warning: include(): Failed opening '/home/andropls/magento/includes/src/Envato_Custompaymentmethod_Helper_Data.php' for inclusion (include_path='/home/andropls/magento/includes/src:.:') in /home/andropls/magento/includes/src/Varien_Autoload.php on line 94
My config.xml
is like following:
<?xml version="1.0"?>
<config>
<modules>
<Envato_Custompaymentmethod>
<version>1.0.0.0</version>
</Envato_Custompaymentmethod>
</modules>
<global>
<fieldsets>
<sales_convert_quote_payment>
<custom_field_one>
<to_order_payment>*</to_order_payment>
</custom_field_one>
<custom_field_two>
<to_order_payment>*</to_order_payment>
</custom_field_two>
</sales_convert_quote_payment>
</fieldsets>
<helpers>
<custompaymentmethod>
<class>Envato_Custompaymentmethod_Helper</class>
</custompaymentmethod>
</helpers>
<blocks>
<custompaymentmethod>
<class>Envato_Custompaymentmethod_Block</class>
</custompaymentmethod>
</blocks>
<models>
<custompaymentmethod>
<class>Envato_Custompaymentmethod_Model</class>
</custompaymentmethod>
</models>
<resources>
<custompaymentmethod_setup>
<setup>
<module>Envato_Custompaymentmethod</module>
</setup>
</custompaymentmethod_setup>
</resources>
</global>
<default>
<payment>
<custompaymentmethod>
<active>1</active>
<model>custompaymentmethod/paymentmethod</model>
<order_status>pending</order_status>
<title>CustomPaymentMethod</title>
<allowspecific>0</allowspecific>
<payment_action>sale</payment_action>
</custompaymentmethod>
</payment>
</default>
<frontend>
<routers>
<custompaymentmethod>
<use>standard</use>
<args>
<module>Envato_Custompaymentmethod</module>
<frontName>custompaymentmethod</frontName>
</args>
</custompaymentmethod>
</routers>
</frontend>
</config>
and this is system.xml
<?xml version="1.0"?>
<config>
<sections>
<payment>
<groups>
<custompaymentmethod translate="label" module="custompaymentmethod">
<label>CustomPaymentMethod Module</label>
<sort_order>1000</sort_order>
<show_in_default>1</show_in_default>
<show_in_website>1</show_in_website>
<show_in_store>0</show_in_store>
<fields>
<title translate="label">
<label>Title</label>
<frontend_type>text</frontend_type>
<show_in_default>1</show_in_default>
<show_in_website>1</show_in_website>
<show_in_store>0</show_in_store>
<sort_order>1</sort_order>
</title>
<active translate="label">
<label>Enabled</label>
<frontend_type>select</frontend_type>
<source_model>adminhtml/system_config_source_yesno</source_model>
<show_in_default>1</show_in_default>
<show_in_website>1</show_in_website>
<show_in_store>0</show_in_store>
<sort_order>2</sort_order>
</active>
<order_status translate="label">
<label>New order status</label>
<frontend_type>select</frontend_type>
<source_model>adminhtml/system_config_source_order_status</source_model>
<show_in_default>1</show_in_default>
<show_in_website>1</show_in_website>
<show_in_store>0</show_in_store>
<sort_order>3</sort_order>
</order_status>
<allowspecific translate="label">
<label>Payment from applicable countries</label>
<frontend_type>allowspecific</frontend_type>
<source_model>adminhtml/system_config_source_payment_allspecificcountries</source_model>
<show_in_default>1</show_in_default>
<show_in_website>1</show_in_website>
<show_in_store>1</show_in_store>
<sort_order>4</sort_order>
</allowspecific>
<specificcountry translate="label">
<label>Payment from Specific countries</label>
<frontend_type>multiselect</frontend_type>
<source_model>adminhtml/system_config_source_country</source_model>
<show_in_default>1</show_in_default>
<show_in_website>1</show_in_website>
<show_in_store>1</show_in_store>
<sort_order>5</sort_order>
</specificcountry>
</fields>
</custompaymentmethod>
</groups>
</payment>
</sections>
</config>
This is helper file Data.php content:
<?php
class Envato_Custompaymentmethod_Helper_Data extends Mage_Core_Helper_Abstract{
}
?>
When I disable the system.xml
file the error is not showing and 'Payment method' option showing correctly in admin. But when I enable the system.xml
file the error log showing the error message and the 'Payment method' option page showing blank page in admin. How to solve this?
Solution
You need to create the helper as it will be used in your system.xml
for translation purpose.
As soon as you write:
<custompaymentmethod translate="label" module="custompaymentmethod">
The module
attribute specifies the helper to be used.
All you need to do is create an empty helper class Helper/Data.php
:
<?php
class Envato_Custompaymentmethod_Helper_Data extends Mage_Core_Helper_Abstract {
}
NB: it seems like you have the compiler enabled. Don't forget to recompile under System > Tools > Compiler once you've created the helper class.
OTHER TIPS
The mentioned error log is of compiled files. Either disable compilation Or recompile by navigating to System > Tools > Compiler