Creating a custom helper class in module
Your module naming convention is quite confusing - you're calling the module itself helper? For the purpose of explaining, I'm choosing to call your module myname_mymodule
In your module ./app/code/community/MyName/MyModule/etc/config.xml
, within the <global>
tags
<helpers>
<mymodule>
<class>MyName_MyModule_Helper</class>
</mymodule>
</helpers>
Then create the file ./app/code/community/MyName/MyModule/Helper/Data.php
<?php
class MyName_MyModule_Helper_Data extends Mage_Core_Helper_Abstract{
}
Then to call that module, you would use
$helper = Mage::helper('mymodule');
Add a directory Helper in the extension directory and in there a file Data.php
class Test_Helper_Helper_Data extends Mage_Core_Helper_Abstract {
public function yourFunction() {
...
your code here
...
}
}
Now you can call it via
Mage::helper('test/helper')->yourFunction();
Also add the following in your config.xml
...
<global>
...
<helpers>
<[extension name]>
<class>[Namespace]_[extension name]_Helper</class>
</[extension name]>
</helpers>
...
</global>
...