1

I'm following this alanstorm tutorial and when I'm trying to load the backend page I've got this error:

Fatal error: Uncaught Error: Class 'Mage_Antonino-banner_Helper_Data' not found

Probably there's some typo or some naming convention error, but I really cannot find it.

app/code/local/Antonino/Banner/etc/config.xml

<?xml version="1.0" encoding="UTF-8" ?>
<config>
    <modules>
        <Antonino_Banner>
            <version>1.0.0</version>
        </Antonino_Banner>
    </modules>
    <global>
        <models>
            <banner>
                <class>Antonino_Banner_Model</class>
            </banner>
        </models>
        <helpers>
            <banner>
                <class>Antonino_Banner_Helper</class>
            </banner>
        </helpers>
    </global>
</config>

And

app/code/local/Antonino/Banner/etc/system.xml

<?xml version="1.0" encoding="UTF-8" ?>
<config>
    <tabs>
        <antonino_banner translate="label" module="antonino-banner">
            <label>Antonino</label>
            <sort_order>350</sort_order>
        </antonino_banner>
    </tabs>
    <sections>
        <antoninobanner translate="label" module="antonino-banner">
            <label>Banner Config Options</label>
            <tab>antonino_banner</tab>
            <frontend_type>text</frontend_type>
            <sort_order>300</sort_order>
            <show_in_default>1</show_in_default>
            <show_in_website>1</show_in_website>
            <show_in_store>1</show_in_store>
            <groups>
                <general translate="label">
                    <label>General</label>
                    <frontend_type>text</frontend_type>
                    <sort_order>5</sort_order>
                    <show_in_default>1</show_in_default>
                    <show_in_website>1</show_in_website>
                    <show_in_store>1</show_in_store>
                    <fields>
                        <choose_category translate="label comment">
                            <label>Choose Category</label>
                            <comment>Select the category to which apply the banner</comment>
                            <frontend_type>select</frontend_type>
                            <source_model>banner/categories</source_model>
                            <show_in_default>1</show_in_default>
                            <show_in_website>1</show_in_website>
                            <show_in_store>1</show_in_store>
                        </choose_category>
                    </fields>
                </general>
                <anothergroup translate="label">
                    <label>Another Group</label>
                    <frontend_type>text</frontend_type>
                    <sort_order>5</sort_order>
                    <show_in_default>1</show_in_default>
                    <show_in_website>1</show_in_website>
                    <show_in_store>1</show_in_store>
                </anothergroup>
            </groups>
        </antoninobanner>
        <antoninobannertwo translate="label" module="antonino-banner">
            <label>Another section</label>
            <tab>antonino_banner</tab>
            <frontend_type>text</frontend_type>
            <sort_order>300</sort_order>
            <show_in_default>1</show_in_default>
            <show_in_website>1</show_in_website>
            <show_in_store>1</show_in_store>
        </antoninobannertwo>
    </sections>
</config>

The error shows when I use the method Mage::helper('banner')->__('Hello') in app/code/local/Antonino/Banner/Model/Categories.php which code is

<?php

class Antonino_Banner_Model_Categories extends Mage_Core_Helper_Abstract
{
    public function toOptionArray()
    {
        return array(
            array('value'=>1, 'label'=>Mage::helper('banner')->__('Hello')),
            array('value'=>2, 'label'=>Mage::helper('banner')->__('Goodbye')),
            array('value'=>3, 'label'=>Mage::helper('banner')->__('Yes')),
            array('value'=>4, 'label'=>Mage::helper('banner')->__('No')),
        );
    }

}

Someone could pls help me? I really cannot figure out why this is not working. Thanks!

5
  • have you created file Data.php at app/code/local/Antonino/Banner/Helper/ ?
    – Piyush
    Commented Nov 15, 2017 at 14:00
  • Yes, here it is: <?php class Antonino_Banner_Helper_Data extends Mage_Core_Helper_Abstract { } The path is right, I've just checked. Thank you for your answer. Commented Nov 15, 2017 at 14:09
  • For some reason, Mage::helper looks for 'Antonino-banner_Helper' instead of 'Antonino_Banner_Helper' Commented Nov 15, 2017 at 14:16
  • I think the code in model is fine, just change module="antonino-banner" to module="banner" in your system.xml file
    – Piyush
    Commented Nov 15, 2017 at 14:38
  • Show us app/etc/modules/AntoninoBanner.xml
    – Nolwennig
    Commented Nov 15, 2017 at 15:01

2 Answers 2

1

Thanks to all the answers, I solved the problem. I've changend all the

<antoninobannertwo translate="label" module="antonino-banner">

In to

<antoninobanner translate="label" module="banner">
1
  • 1
    I will thanks. But without your help, probably I could not make it. Thanks again Commented Nov 16, 2017 at 9:02
0

There are a typo in: app/code/local/Antonino/Banner/etc/system.xml

<?xml version="1.0" encoding="UTF-8" ?>
 <config>
   <tabs>
     <antonino_banner translate="label" module="antonino-banner">
                                                        ^

And this is repeated in:

<antoninobanner translate="label" module="antonino-banner">
                                                  ^

and in:

<antoninobannertwo translate="label" module="antonino-banner">
                                                     ^

should be

 <?xml version="1.0" encoding="UTF-8" ?>
  <config>
   <tabs>
    <antonino_banner translate="label" module="antonino_banner">
                                                       ^
1
  • Now it works! Thank you so much. And especially thank also to Piyush who found the error too. Thanks everyone Commented Nov 15, 2017 at 17:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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