How To Add System Configuration Fields

We are going to add new configuration input.

Creating new system configuration inputs is very convenient in magento, since there is no need to do anything with database.

Create system.xml in your module etc/ directory.

<config>
    <sections>
        <general translate="label">
            <groups>
                <example>
                    <label>Example options</label>
                    <sort_order>0</sort_order>
                    <show_in_default>1</show_in_default>
                    <show_in_website>1</show_in_website>
                    <show_in_store>1</show_in_store>
                    <fields>
                        <some_field translate="label">
                            <label>Some Field</label>
                            <frontend_type>text</frontend_type>
                            <show_in_default>1</show_in_default>
                            <show_in_website>1</show_in_website>
                            <show_in_store>1</show_in_store>
                        </some_field>
                    </fields>
                </example>
            </groups>
        </general>
    </sections>
</config>

Usage

You can get the value of your configuration field by calling this function in code.

Mage:getStoreConfig('general/example/some_field');
//general - this is section
//example - this is group
// some_field - this is field
/*Follow the system.xml to know where they come from*/

 


Lukas
Lukas Stranovsky
I am the guy who made this. Sorry for typos.