Magento – Define default values in config.xml

You can define system config value defaults in your modules config.xml like that.

<?xml version="1.0"?>
<default>
    <myconfig_group>
        <settings>
            <test>1</test>
            <cronjobs>0</cronjobs>
            <client>0813</client>
            <serviceprovider>117</serviceprovider>
            <pricelist></pricelist>
        </settings>
        <productexport>
            <lux_kategorie>21</lux_kategorie>
            <store_view_german>1</store_view_german>
            <store_view_english>12</store_view_english>
        </productexport>
    </myconfig_group>
</default>

This sets the default value for all stores.

If you want to set default values for a special store (scope), you can do it this way:

<?xml version="1.0"?>
<stores>
    <gb>
        <myconfig_group>
	    <settings>
		<client>0814</client>
		<pricelist>123</pricelist>
	    </settings>
	</myconfig_group>
    </gb>
    <ch>
        <myconfig_group>
	    <settings>
		<client>0815</client>
		<pricelist>1234</pricelist>
	    </settings>
	</myconfig_group>
    </ch>
</stores>

If you want to set default values on website scope, you can do it this way:

<?xml version="1.0"?>
<websites>
    <website_code>
        <myconfig_group>
            <settings>
                <client>0814</client>
                <pricelist>123</pricelist>
            </settings>
        </myconfig_group>
    </website_code>
    <website_code2>
        <myconfig_group>
            <settings>
                <client>0815</client>
                <pricelist>1234</pricelist>
            </settings>
        </myconfig_group>
    </website_code2>
</websites>

 

One thought on “Magento – Define default values in config.xml

Leave a Reply

Your email address will not be published.

 

This site uses Akismet to reduce spam. Learn how your comment data is processed.