I've made a new module called test_helper and I want to create a helper class in this module so that I can add custom functions to be called all over my site.

I can't however seem to find any examples of just how to go about doing this. I assume I have to create some extra xml in config and ad another file somewhere that extends a base helper but I've not had any luck finding an example to build upon.

2 Answers 2


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


Then create the file ./app/code/community/MyName/MyModule/Helper/Data.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


Also add the following in your config.xml

        <[extension name]>
            <class>[Namespace]_[extension name]_Helper</class>
        </[extension name]>
  • Thank you very much you two, This backs up the tiny bit of info I was able to find and I was able to get it working in the end. I'm not actually calling it test_helper that was just for me to go through stuff on my litle test block but yeah dumb idea calling it helper =p Mar 7, 2013 at 10:35
  • You're probably better off renaming it but main thing is it works! good luck with the project Mar 7, 2013 at 10:40

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.