在系统配置中添加“自定义”选项卡

大家好,

在这里,我向您解释如何在系统->配置区域中添加自定义标签。

好吧,首先,您需要一个扩展来为其构建配置。 如果您是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

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值