在 Magento v1.5.0.1 中,有人知道使用<frontend_type>checkbox</frontend_type>
system.xml 中的配置指令的问题吗?即使在只有一个配置变量且没有块/模型的最简单的哑模块中,如果我选中该框并点击“保存”,它也会重新加载页面并取消选中该复选框,即使它表示配置已成功保存。我搜索了代码,它只在几个地方使用。大多数时候,人们使用<frontend_type>select</frontend_type>
with <source_model>adminhtml/system_config_source_yesno</source_model>
。这行得通,但为什么复选框也不起作用?还是我误解了 Magento 复选框应该如何工作?
如果有帮助,这是我的文件。在这种情况下,我还添加了一个文本字段变量。如果我输入文本并点击保存,那确实会保存,但复选框不会:
配置.xml:
<?xml version="1.0" encoding="UTF-8"?>
<config>
<modules>
<Brian_Stupid>
<version>0.1.0</version>
</Brian_Stupid>
</modules>
<adminhtml>
<acl>
<resources>
<admin>
<children>
<system>
<children>
<config>
<children>
<stupid translate="title">
<title>Stupid Crap</title>
</stupid>
</children>
</config>
</children>
</system>
</children>
</admin>
</resources>
</acl>
</adminhtml>
</config>
系统.xml:
<?xml version="1.0"?>
<config>
<sections>
<stupid translate="label">
<label>Stupid Test</label>
<tab>catalog</tab>
<frontend_type>text</frontend_type>
<sort_order>998</sort_order>
<show_in_default>1</show_in_default>
<show_in_website>1</show_in_website>
<show_in_store>1</show_in_store>
<groups>
<debug translate="label">
<label>Debugging</label>
<frontend_type>text</frontend_type>
<sort_order>5</sort_order>
<show_in_default>1</show_in_default>
<show_in_website>1</show_in_website>
<show_in_store>1</show_in_store>
<fields>
<debugmode translate="label">
<label>Debug Mode Enable</label>
<comment>If enabled, does not alter database. Prints debug messages and dies</comment>
<frontend_type>checkbox</frontend_type>
<sort_order>5</sort_order>
<show_in_default>1</show_in_default>
<show_in_website>1</show_in_website>
<show_in_store>1</show_in_store>
</debugmode>
<texttest translate="label">
<label>Text Test</label>
<frontend_type>text</frontend_type>
<sort_order>10</sort_order>
<show_in_default>1</show_in_default>
<show_in_website>1</show_in_website>
<show_in_store>1</show_in_store>
</texttest>
</fields>
</debug>
</groups>
</stupid>
</sections>
</config>