How can I assign a default value to a config value, which i am defining in a system.xml file? Currently it defaults to 'no', but i want it to default to 'yes'.
Here is my current definition code:
<catalog>
<groups>
<my_val>
<label>My Label</label>
<frontend_type>text</frontend_type>
<sort_order>160</sort_order>
<show_in_default>1</show_in_default>
<show_in_website>1</show_in_website>
<show_in_store>1</show_in_store>
<fields>
<my_inner_val translate='label comment'>
<label>Enable seperate cart items</label>
<frontend_type>select</frontend_type>
<source_model>adminhtml/system_config_source_yesno</source_model>
<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>
</my_inner_val>
</fields>
</my_val>
</groups>
</catalog>
Best Answer
You can easily add default values for all configuration settings in your
config.xml
:At the moment I'm unable to map your
system.xml
setting name to the node in theconfig.xml
I would say it is:
catalog/my_val/my_inner_val
, means:Small tip in the end: Be careful with the
int
settings. Sometimes magento uses1
and2
for yes/no, on/off, etc.