3

How can I add a field in admin panel > system > configuration > General Tab ?

Please specify Path for file in Magento 1.9

I am using code below but no success:

<sections>
    <custom translate="label" module="custom">
        <label>Custom</label>
        <tab>general</tab>
        <sort_order>60</sort_order>
        <show_in_default>1</show_in_default>
        <show_in_website>1</show_in_website>
        <show_in_store>1</show_in_store>
    <groups>
        <store_number translate="label">
                <label>Store Customer Care Number</label>
                <frontend_type>text</frontend_type>
                <sort_order>100</sort_order>
                <show_in_default>1</show_in_default>
                <show_in_website>1</show_in_website>
                <show_in_store>1</show_in_store>
                <fields>
                    <contact_info translate="label">
                        <label>Store Customer Care Number</label>
                        <frontend_type>text</frontend_type>                    
                        <sort_order>2</sort_order>
                        <show_in_default>1</show_in_default>
                        <show_in_website>1</show_in_website>
                        <show_in_store>1</show_in_store>
                    </contact_info>                        
                </fields>
         </store_number>
    </groups>
    </custom>
</sections>
3

In your module add below code:

In file app/code/local/Namesapce/Modulename/etc/system.xml

 <general>            
       <groups>
            <test translate="label">
                    <label>Test Options</label>
                    <frontend_type>text</frontend_type>
                    <sort_order>1</sort_order>
                    <show_in_default>1</show_in_default>
                    <show_in_website>1</show_in_website>
                    <show_in_store>1</show_in_store>
                    <fields>
                        <enable translate="label">
                            <label>Enable</label>
                            <frontend_type>select</frontend_type>
                            <source_model>adminhtml/system_config_source_yesno</source_model>                       
                            <sort_order>2</sort_order>
                            <show_in_default>1</show_in_default>
                            <show_in_website>1</show_in_website>
                            <show_in_store>1</show_in_store>
                            <can_be_empty>1</can_be_empty>
                        </enable>                        
                    </fields>
                </test>
        </groups>
   </general>
  • Thanks. Using above code I can add new section under General Tab. – Pratik Chheda Jun 16 '16 at 5:18
2

A module can be created using following files:

app/etc/modules/Vendor_Module.xml

<?xml version="1.0"?>
<config>
    <modules>
        <Vendor_Module>
            <active>true</active>
            <codePool>local</codePool>
        </Vendor_Module>
    </modules>
</config>

app/code/local/Vendor/Module/etc/config.xml

<?xml version="1.0"?>
<config>
    <modules>
        <Vendor_Module>
            <version>0.0.1</version>
        </Vendor_Module>
    </modules>
    <global>
        <helpers>
            <class>Vendor_Module_Helper</class>
        </helpers>
    </global>
</config>

app/code/local/Vendor/Module/etc/system.xml

<?xml version="1.0"?>
<config>
    <sections>
        <custom translate="label" module="module">
            <label>Custom</label>
            <tab>general</tab>
            <sort_order>60</sort_order>
            <show_in_default>1</show_in_default>
            <show_in_website>1</show_in_website>
            <show_in_store>1</show_in_store>
            <groups>                    
                <custom_group>
                    <fields>
                        <hours translate="label">
                            <label>Store Contact Hours</label>
                            <frontend_type>text</frontend_type>
                            <sort_order>21</sort_order>
                            <show_in_default>1</show_in_default>
                            <show_in_website>1</show_in_website>
                            <show_in_store>1</show_in_store>
                        </hours>
                    </fields>
                </custom_group>
            </groups>
        </custom>
    </sections>
</config>

app/code/local/Vendor/Module/Helper/Data.php

<?php

class Vendor_Module_Helper_Data extends Mage_Core_Helper_Abstract
{
}

In this example, I've added a Store Contact Hours field but you can change it to whatever you want.

The value of the field will be accessible by Mage::getStoreConfig('custom/custom_group/hours');

  • Thank for reply. I tried this but its not working. I want to show it in system > configuration > General Tab below content management. – Pratik Chheda Jun 15 '16 at 8:50
  • @Pratik ok got it I updated the answer – Raphael at Digital Pianism Jun 15 '16 at 9:00
  • Posted my edited code. – Pratik Chheda Jun 15 '16 at 9:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.