0

I am getting the following error:

Fatal error: Class 'Mage_VMR_Customreports_Helper_Data' not found in /Volumes/Apache/mage/app/Mage.php on line 546

where VMR is my namespace and Customreports is my module name.

Now usually I fix this by putting

class Mage_VMR_Customreports_Helper_Data extends Mage_Core_Helper_Abstract
{

}

in /Helper/Data.php but that isn't fixing it this time.

I have noticed that the error changes when I change the menu definition in config.xml

which is currently:

<menu>
    <vmr_menu>
        <children>
            <customreports translate="title" module="VMR_Customreports">
                ...
            </customreports>
        </children>
    </vmr_menu>
</menu>

My config.xml helper stuff is:

<global>
    <helpers>
        <customreports>
            <class>VMR_Customreports_Helper</class>
        </customreports>
    </helpers>
</global>

and my Data.php is:

<?php

class VMR_Customreports_Helper_Data extends Mage_Core_Helper_Abstract
{

}

class Mage_VMR_Customreports_Helper_Data extends Mage_Core_Helper_Abstract
{

}

How do I fix it?

  • FYI, when I remove ' translate="title" module="VMR_Customreports" ' from the menu definition, it works fine – user2045 Jun 3 '13 at 17:50
  • but then I get errors elsewhere – user2045 Jun 3 '13 at 18:00
  • Yeah so apparently getting rid of any use of Mage::helper(My_Module) 'fixes' it, but I need to use my helper. :( – user2045 Jun 3 '13 at 18:19
  • Also, I have the <helpers> block defined in <globals> as I should – user2045 Jun 3 '13 at 18:20
  • 1
    Please post the helper declaration in config.xml and also the example of how you call your helper. – user487772 Jun 3 '13 at 19:03
2

Your module attribute must match your class group under global/helpers xpath (i.e. customreports):

<menu>
    <vmr_menu>
        <children>
            <customreports translate="title" module="customreports">
            ...
            </customreports>
        </children>
    </vmr_menu>
</menu>

Think of the argument from the module attribute as being used to grab the specified helper class singleton (because it is - see Mage_Adminhtml_Block_Page_Menu::_getHelperValue()):

/**
 * Retrieve Title value for menu node
 *
 * @param Varien_Simplexml_Element $child
 * @return string
 */
protected function _getHelperValue(Varien_Simplexml_Element $child)
{
    $helperName         = 'adminhtml';
    $titleNodeName      = 'title';
    $childAttributes    = $child->attributes();
    if (isset($childAttributes['module'])) {
        $helperName     = (string)$childAttributes['module'];
    }

    return Mage::helper($helperName)->__((string)$child->$titleNodeName);
}

And don't forget that when there is no slash present in the factory argument for helpers, /data is assumed in Mage_Core_Model::getHelperClassName(), i.e. Mage::getHelper('customreports') is a.k.a Mage::getHelper('customreports/data').

1

It looks like you might just have an extra "Mage_" at the start of your helper class name. So, Magento would be looking in YourRoot/app/code/YourCodePool/Mage/VMR/Customreports/Helper/

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.