Friday, 1 June 2018

Admin config with extendable amount of fields system.xml in magento 1.9

app/code/local/Abhi/Banner/etc/system.xml

<config>
    <sections>
        <abhi_banner_settings translate="label" module="banner">
             <label>HSN Number Settings</label>
            <tab>general</tab>
            <frontend_type>text</frontend_type>
            <sort_order>304</sort_order>
            <show_in_default>1</show_in_default>
            <show_in_website>1</show_in_website>
            <show_in_store>1</show_in_store>
            <groups>
                <abhi_banner_rule translate="label">
                    <label>HSN </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>

                        <hsnnumber translate="label">
                            <label>HSN Number</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>
                        </hsnnumber>
                    </fields>
                </abhi_banner_rule>
            </groups>
        </abhi_banner_settings>
    </sections>
</config>

===============================
app/code/local/Abhi/Banner/etc/adminhtml.xml

<config>
    <acl>
        <resources>
            <admin>
                <children>
                    <system>
                        <children>
                            <config>
                                <children>
                                    <abhi_banner_settings translate="title">
                                        <title>HSN Number Settings</title>
                                        <sort_order>55</sort_order>
                                    </abhi_banner_settings>
                                </children>
                            </config>
                        </children>
                    </system>
                </children>
            </admin>
        </resources>
    </acl>
</config>

get value:-
<?php
$store = Mage::app()->getStore(); // store info
echo $configValue = Mage::getStoreConfig('abhi_banner_settings/abhi_banner_rule/hsnnumber', $store);
?>

No comments:

Post a Comment