【问题标题】:Magento 1.9: dynamic config.xmlMagento 1.9:动态 config.xml
【发布时间】:2017-01-19 22:55:46
【问题描述】:

我正在创建一个 Magento 1.9 模块,并且到目前为止已经定义了设置(可以使用),然后我继续为我的设置字段添加默认值。现在,我想知道,是否有可能在 config 中有一个将链接到其他值的值?如,我想为值将是站点名称或站点描述的字段添加默认设置。

【问题讨论】:

  • 我投票结束这个问题,因为 Stack Overflow 是一个programming-related 问答网站。您的问题与编程无关。也许你应该把它发到magento.stackexchange.com 上?
  • “与编码无关”是什么意思?我的问题基本上是如何编码我在那里问的内容。我真的完全不明白你的评论。是因为我没有提供任何代码吗?这不会有任何帮助,所以我没有。
  • 听起来您在询问 Magento 的配置设置。据我所知,这里没有关于编码的内容。您能否尝试尽可能多地编写您的解决方案,然后,我们卡住了,请确认您的代码并再次询问?
  • 嗯,问题是,刚才我已经准备好了一切,并且正在工作。问题是我在问是否可以编码。你读过我的问题吗?
  • 是的,没有关于那里的编码,除了你说你正在创建一个模块。这本身并不是编码。您需要显示您的代码以及出了什么问题。我们不是代码编写或代码设计服务。我们在这里帮助您解决特定的编程问题。

标签: magento magento-1.9


【解决方案1】:

创建 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>

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2014-05-20
    • 2020-09-13
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多