aneesahmadweb@gmail.com     03040836207

    What are helper in Magento and How to make or use

    As suggest by its name this is something that is Helpfull.But in Magento we say it a OBJECT  that contains a practical functions.Now when we need we can call this function anywhere in our code.,,

    Lets make a Helper function and than use that practically in our codeWhat are helper in Magento and How to make
    In your config register the Helper that you are going to make,

    keep remeber: Declare this in <global> tag

    <global>
    <helpers>
    <mymodule>
    <class>Test_Mymodule_Helper</class>
    </mymodule>
    </helpers>
    </global>

     

    Navigate to Helper folder of your module and Create a file Data.php

    class Test_Mymodule_Helper_Data  extends  Mage_Core_Helper_Abstract {
    public function hello() {
    return 'hello there';
    }
    }
    

    You see first we declare our module in config file,than make a Data.php file that extends Mage_Core_Helper_Abstract class.

    Now we want to call our helper into the code,

    Mage::helper('mymodule')->hello();
    
    

    this will call hello() function from the module name “yourmodule”.

    Read out More about Module Development Visit: http://devdocs.magento.com/

    About Author

    You may also like

    No Comment

    You can post first response comment.

    Leave A Comment

    Please enter your name. Please enter an valid email address. Please enter a message.