大家好,
在这里,我向您解释如何在系统->配置区域中添加自定义标签。
好吧,首先,您需要一个扩展来为其构建配置。 如果您是Magento的新手,并且不知道如何创建自己的扩展,则此站点上有很多关于此扩展的文章,但是我的建议是从全新扩展开始进行测试。
现在介绍有趣的东西。 首先,您需要添加(或编辑)您的system.xml文件。
<?xml version="1.0" encoding="UTF-8"?>
<config>
<tabs>
<inchoo translate="label" module="mymodule">
<label>Inchoo Extensions</label>
<sort_order>100</sort_order>
</inchoo>
</tabs>
<sections>
<inchoo translate="label" module="mymodule">
<label>Extension Options</label>
<tab>inchoo</tab>
<sort_order>1000</sort_order>
<show_in_default>1</show_in_default>
<show_in_website>1</show_in_website>
<show_in_store>1</show_in_store>
<groups>
<inchoo_group translate="label" module="mymodule">
<label>My Extension Options</label>
<frontend_type>text</frontend_type>
<sort_order>1000</sort_order>
<show_in_default>1</show_in_default>
<show_in_website>1</show_in_website>
<show_in_store>1</show_in_store>
<fields>
<inchoo_input translate="label">
<label>My Input Field: </label>
<comment>My Comment</comment>
<frontend_type>text</frontend_type>
<sort_order>20</sort_order>
<show_in_default>1</show_in_default>
<show_in_website>1</show_in_website>
<show_in_store>1</show_in_store>
</inchoo_input>
<inchoo_select translate="label">
<label>My Dropdown: </label>
<comment>Source model provider Magento’s default Yes/No values</comment>
<frontend_type>select</frontend_type>
<sort_order>90</sort_order>
<show_in_default>1</show_in_default>
<show_in_website>1</show_in_website>
<show_in_store>1</show_in_store>
<source_model>adminhtml/system_config_source_yesno</source_model>
</inchoo_select>
</fields>
</inchoo_group>
</groups>
</inchoo>
</sections>
</config>
然后,为了使用Magento的配置部分,您需要添加(或编辑)扩展程序的config.xml文件,并定义模型和助手位置。
<config>
<modules>
<Inchoo_Mymodule>
<version>0.1.0</version>
</Inchoo_Mymodule>
</modules>
<global>
<models>
<mymodule>
<class>Inchoo_Mymodule_Model</class>
</mymodule>
</models>
<helpers>
<mymodule>
<class>Inchoo_Mymodule_Helper</class>
</mymodule>
</helpers>
</global>
</config>
最后,您需要再次编辑扩展程序的config.xml文件,以避免“权限被拒绝”。
问题。
将XML的这一部分插入“ <config> </ config>”标签内:
<adminhtml>
<acl>
<resources>
<all>
<title>Allow Everything</title>
</all>
<admin>
<children>
<system>
<children>
<config>
<children>
<inchoo>
<title>Inchoo - All</title>
</inchoo>
</children>
</config>
</children>
</system>
</children>
</admin>
</resources>
</acl>
</adminhtml>
如果您已正确完成所有操作,则应在管理面板syatem-> Configuration->左侧Inchoo Extension选项卡中看到。 -希望对您有帮助
From: https://bytes.com/topic/php/insights/948081-add-custom-tab-system-configuration