Home » Magento26 January 2015

Magento: Add Custom Selection List in System Configuration

This tutorial shows how to add a custom select list in configuration settings of a custom Magento module.

Suppose, your module’s namespace is YourNamespace and your module’s name is YourModule. And, you want to add a selection list of Brands that contains mobile brand names like Samsung, Sony, Apple, etc.

Here is the code to add in your module’s system.xml file.

Note: I have set Group Name as ‘yourgroupname’, Field Name as ‘yourfield’. You can change that to your desired name.

From the above system.xml code, you can see that the source model is defined as “yourmodule/system_config_source_brands“. So, you have to create a new model class in your module.

Class name will be YourNamespace_YourModule_Model_System_Config_Source_Brands and the file location will be YourNamespace/YourModule/Model/System/Config/Source/Brands.php.

Here is the class code:

Make sure that model class is defined in your module’s config.xml file.

Hope this helps. Thanks.

Magento

Get New Post by Email

Find me on

FacebookTwitterGoogle+LinkedInRSS Feed
  • ADAMS

    I ADAMS KEVIN, a representative Aiico Insurance plc, we trust and respect for individual differences in day out a loan. We will provide 2% of the loan’s interest rate. If you are interested in this business contact us by e-mail: (adams.credi@gmail.com) now transfer their loan documents issued properly. Do you need a loan to set up business or school if you are very welcome to Aiico Insurance plc. You can also contact us by e-mail: (adams.credi@gmail.com). We first week can request a balance transfer.

    DO YOU NEED LOAN FOR PERSONAL BUSINESS? IF YOU CONTACT YOUR EMAIL ABOVE TO PROCEED WITH YOUR LOAN TRANSFER IMMEDIATELY OK.