Magento: System Configuration with Tab for Custom Module

This article shows how to add system configuration (System -> Configuration) menu with menu tab for your custom module.

Let us suppose, you have already created a local module.

Module Namespace: Chapagain
Module Name: News

Here is a step-by-step guide:-

1) Create app/code/local/Chapagain/News/etc/system.xml with the following code:-


<?xml version="1.0" ?>
<config>
    <tabs>
        <news translate="label" module="news">
            <label>Chapagain</label>
            <sort_order>10</sort_order>
        </news>
    </tabs>
    <sections>
        <news translate="label" module="news">
            <label>Info</label>
            <tab>news</tab>
            <frontend_type>text</frontend_type>
            <sort_order>120</sort_order>
            <show_in_default>1</show_in_default>
            <show_in_website>1</show_in_website>
            <show_in_store>1</show_in_store>
            <groups>                
                <general>
                    <label>General Settings</label>
                    <frontend_type>text</frontend_type>
                    <sort_order>10</sort_order>
                    <show_in_default>1</show_in_default>
                    <show_in_website>1</show_in_website>
                    <show_in_store>1</show_in_store>
                    <fields>
                        <no_of_items translate="label">
                            <label>Number of news</label>
                            <comment>To be displayed on homepage of module</comment>
                            <frontend_type>text</frontend_type>
                            <sort_order>10</sort_order>
                            <show_in_default>1</show_in_default>
                            <show_in_website>1</show_in_website>
                            <show_in_store>1</show_in_store>                            
                        </no_of_items>
                        <sidebar translate="label">
                            <label>Sidebar news</label>
                            <comment>To be displayed on sidebar</comment>
                            <frontend_type>text</frontend_type>
                            <sort_order>20</sort_order>
                            <show_in_default>1</show_in_default>
                            <show_in_website>1</show_in_website>
                            <show_in_store>1</show_in_store>                            
                        </sidebar>
                    </fields>   
                </general>      
            </groups>
        </news>
    </sections>
</config>

We have created a new system tab with label ‘Chapagain’. The tab menu/section is named ‘Info’. The section group is named ‘General Settings’. This group has two fields.

2) Edit/Create app/code/local/Chapagain/News/etc/adminhtml.xml and write the following code:

Note: If you are using older version (prior to 1.4) of Magento then you should write the following code inside adminhtml node of config.xml file of your module.


<?xml version="1.0"?>
<config>
    .
    .
    .
    <acl>
        <resources>
            <all>
                <title>Allow Everything</title>
            </all>
            <admin>
                <children>
                    <system>
                        <children>
                            <config>
                                <children>
                                    <news translate="title" module="news">
                                        <title>News Module</title>
                                        <sort_order>10</sort_order>
                                    </news>
                                </children>
                            </config>
                        </children>
                    </system>
                </children>
            </admin>
        </resources>
    </acl>
    .
    .
    .
</config>

More detail and in-depth information about Magento System Configuration can be found in the following articles by Ivan Chepurnyi:-

Custom configuration fields in Magento

Defining ACL resources & Custom Admin Menu in Magento

Enjoy!