Magento 1.9:动态config.xml

时间:2017-01-19 22:55:46

标签: magento magento-1.9

我正在创建一个Magento 1.9模块,并且到目前为止定义了设置(可以正常工作),然后我开始为我的设置字段添加默认值。现在,我想知道,是否有可能在配置中有一个值,它将与其他一些值相关联?在中,我想为字段添加默认设置,其中值将是站点名称或站点描述。

1 个答案:

答案 0 :(得分:0)

创建system.xml并使用以下示例代码:

<?xml version="1.0"?>
<config>
    <sections>
        <folder translate="label" module="modulename">            
            <groups>
               <site_details>
                    <label>Website discription</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>
                        <name translate="label">
                            <label>Site name</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>
                        </name>
                        <description>
                            <label>description</label>
                            <comment><![CDATA[description]]></comment>
                            <frontend_type>textarea</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>
                        </description>
                    </fields>   
               </site_details>  
            </groups>
        </floder>
      </sections>
</config>
相关问题