2
votes

I'me new to Magento. I've created a helper class

/app/etc/modules/Mytrends_MyFunctions.xml file:

<?xml version="1.0"?>
<config>
    <modules>
        <Mytrends_MyFunctions>
            <active>true</active>
            <codePool>local</codePool>
        </Mytrends_MyFunctions>
    </modules>
</config>

/app/code/local/Mytrends/MyFunctions/etc/config.xml :

<?xml version="1.0"?>
<config>
<modules>
        <Mytrends_MyFunctions>
            <version>1.0.0</version>
        </Mytrends_MyFunctions>
    </modules>
    <global>
        <helpers>
            <myfunctions>
                <class>Mytrends_MyFunctions_Helper</class>
            </myfunctions>
        </helpers>
     </global>
</config>

/app/code/local/Mytrends/MyFunctions/Helper/Data.php :

<?php
class Mytrends_MyFunctions_Helper_Data extends Mage_Core_Helper_Abstract
{
        public function test () {
            echo 'hello';
        }
}
?>

And i tried to call this test() like this

Mage::helper('myfunctions')->test();

but i got a fatal error:

Fatal error: Class 'Mytrends_MyFunctions_Helper_Data' not found in /app/Mage.php on line 548

Please help.

3
Have you tried flushing the configuration cache? - Fran Mayers
a bad habit you should really loose is to close php on a class. You should never ever do this. please read stackoverflow.com/questions/4410704/ - β.εηοιτ.βε

3 Answers

0
votes

you have to call helper function like this:

Mage::helper('mytrends/myfunctions')->test();

Please try this.

0
votes

Please check your module config.xml file path properly.

0
votes

This file doesn't have to right name : /app/etc/modules/config.xml it should be /app/etc/modules/Mytrends_MyFunctions.xml