是否有可能(通过编程或xml配置)为文本字段admin配置选项设置默认值?如果是这样,怎么样?Magento - 管理员字段的默认值
11
A
回答
32
您可以通过您的模块的config.xml文件将默认值添加到admin config选项。通过管理员配置选项,我明白你的意思是配置设置选项(系统 - >配置)。
假设,您有以下system.xml文件。 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>
现在,默认值添加到管理员的配置选项,你需要写在你的模块的config.xml文件以下。
<default>
<mysection>
<mygroup>
<myfield>My Default Value</myfield>
</mygroup>
</mysection>
</default>
希望这会有所帮助。
对于详细的解释,你可以参考: - http://alanstorm.com/magento_default_system_configuration_values
0
<default>
<catalog><!-- tag of the system.xml section -->
<frontend><!-- tag of the system.xml group -->
<name_of_your_field>4</name_of_your_field><!-- tag of the system.xml field -->
</frontend>
</catalog>
</default>
相关问题
- 1. Magento更改管理中的选择字段的默认值
- 2. 值的字段的默认Django管理
- 3. 在drupal 6中设置字段的默认值管理员
- 4. 让站点管理员管理Django中的默认值
- 5. Django的管理员 - 如何从其他表中拉模型默认字段值
- 6. Magento管理员 - 更改默认配置菜单
- 7. Wordpress CUstom字段管理视图中的默认字段
- 8. magento onepage checkout管理字段
- 9. 设置Django管理员默认操作
- 10. 调整django管理员默认权限
- 11. Django管理员:删除默认链接
- 12. springSecurityService的默认字段值
- 13. 管理magento中的管理员帐户
- 14. Django管理员表单和默认值的内联模型
- 15. Magento的 - 管理员登陆
- 16. 锁定了管理员,我改变了默认的admin URL
- 17. Avro字段默认值
- 18. Sensenet DateTime字段默认值
- 19. Django AdminForm字段默认值
- 20. 选项字段默认值
- 21. Odoo 8 - 默认字段值
- 22. 覆盖默认值字段
- 23. Magento类别缩略图字段未在管理员中显示
- 24. Magento。重写保存为管理员自定义字段
- 25. 项目管理员组的TFS默认组成员身份
- 26. Hibernate中嵌入字段的默认值。 java.sql.SQLException:字段'url'没有默认值
- 27. Magento管理员侧栏
- 28. Magento管理员登录
- 29. Magento管理员通知
- 30. Magento管理员端定制
这似乎并不为我工作。我刷新了缓存,存储缓存,登录和注销,清除了浏览器缓存。我还必须做些什么才能使违约行为起作用? – ahnbizcad 2015-10-07 21:11:16