Magento将默认值添加到系统配置选项字段
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Magento将默认值添加到系统配置选项字段相关的知识,希望对你有一定的参考价值。
This article shows how to add default value to any system configuration option fields. System configuration option fields means those options under System -> Configuration.Suppose, you have the following system.xml file. System.xml file is necessary to add admin configuration options.
system.xml <?xml version="1.0" encoding="UTF-8"?> <config> <sections> <mysection translate="label" module="mymodule"> <label>My Section</label> <tab>catalog</tab> <frontend_type>text</frontend_type> <sort_order>110</sort_order> <show_in_default>1</show_in_default> <show_in_website>1</show_in_website> <show_in_store>1</show_in_store> <groups> <mygroup translate="label" module="mymodule"> <label>My Group</label> <frontend_type>text</frontend_type> <sort_order>99</sort_order> <show_in_default>1</show_in_default> <show_in_website>1</show_in_website> <show_in_store>1</show_in_store> <fields> <myfield translate="label comment"> <label>My Field</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> </myfield> </fields> </mygroup> </groups> </mysection> </sections> </config> Now, to add default value to the admin configuration options, you need to write the following in config.xml file of your module. The should be inside config node. config.xml <default> <mysection> <mygroup> <myfield>My Default Value</myfield> </mygroup> </mysection> </default> http://www.magentocommerce.com/wiki/5_-_modules_and_development/admin/xml_structure_for_admin_configurations
以上是关于Magento将默认值添加到系统配置选项字段的主要内容,如果未能解决你的问题,请参考以下文章