2

I am developing a small custom module. While creating an admin screen under system->configuration, I am getting following error Fatal error: Class 'Mage_Screen_Helper_Data' not found in /app/Mage.php on line 546

I checked my code but nothing seems wrong. Below is the code of my config.xml

    <?xml version="1.0"?>
<config>
    <modules>
        <Study_Screen>
            <version>0.1.0<version>
        </Study_Screen>
    </modules>
    <global>
        <models>
            <screen>
                <class>Study_Screen_Model</class>
            </screen>
        </models>
        <helpers>
            <screen>
                <class>Study_Screen_Helper</class>
            </screen>
        </helpers>
        <blocks>
            <screen>
                <class>Study_Screen_Block</class>
            </screen>
        </blocks>
    </global>
    <adminhtml>
        <acl>
            <resources>
                <admin>
                    <children>
                        <system>
                            <children>
                                <config>
                                    <children>
                                        <screen translate="title" module="screen">
                                            <title>Screen Settings</title>
                                        </screen>
                                    </children>
                                </config>
                            </children>
                        </system>
                    </children>
                </admin>
            </resources>
        </acl>
    </adminhtml>
</config>

Next I created Data.php in Helper folder. The code for Data.php is

 <?php
class Study_Screen_Helper_Data extends Mage_Core_Helper_Data
{
}
?>

and at last i created system.xml in etc folder. Code for system.xml is

<?xml version="1.0"?>
<config>
    <sections>
        <screen translate="label" module="screen">
            <label>Screen</label>
            <tab>sales</tab>
            <frontend_type>text</frontend_type>
            <sort_order>1000</sort_order>
            <show_in_default>1</show_in_default>
            <show_in_website>1</show_in_website>
            <show_in_store>1</show_in_store>
        </screen>
    </sections>
</config>

Everything seems to be fine. I can't figure out the error. Any help will be appreciated.

5

First clear the cache.
Then check if the file app/etc/modules/Study_Screen.xml exists. I think it does, but check it to be sure.
I also see there is a space at the beginning of your config.xml: before <?xml version="1.0"?>. remove that (and maybe clear the cache again).

[EDIT]
I've test your code. Here is the problem: in config.xml you have this line

<version>0.1.0<version>

The version tag is not closed. It should be

<version>0.1.0</version>

Tip for the future:
Always develop with error reporting set to E_ALL with display_errors on and mage developer mode set to true. If you do this you will get error messages on problems like this.

  • I tried it all, but its not working. I also tried putting the module in another copy of magento. Still the same error prevails – Dexter Aug 26 '13 at 7:10
  • Also if i remove the code from system.xml its working fine. I am also getting the same error when browsing to user roles. – Dexter Aug 26 '13 at 7:12
  • The problem is, that magento can not find your helper to translate the labels. If you remove translate="label" it should work already. The question is, how does magento try to initialize the helper. I thought module="screen" -> helper('screen') but obviosuly I'm wrong. – Fabian Blechschmidt Aug 26 '13 at 7:18
  • @Dexter. I've edited my answer. Even if my first answer didn't solve your problem I will leave it there because there are some good pointers. – Marius Aug 26 '13 at 7:25
  • @FabianBlechschmidt. It's not a good idea to hide the errors like this. If the helper is not found but it's declared correctly in config.xml most probable means that the config file is not loaded. This will lead to other problems in the future if you hide the error. And you are not wrong: module="screen" turns into helper('screen') when translating the labels. – Marius Aug 26 '13 at 7:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.