在Magento System Configuration页面添加配置项

以 Jp_Coupon 模块为例:

目标: 在 System configuration 页面添加一个 JP tab, 在JP中添加 Coupon section, 然后给 Coupon section 添加2个配置项

按照以下步骤:

1. app/code/local/Jp/Coupon/ect/system.xml 文件

添加 jp tab 和 jp_coupon section

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
<?xml version="1.0"?>
<config>
    <tabs>
        <jp translate="label" module="jp_coupon">
            <label>JP Extentions </label>
            <sort_order>200 </sort_order>
        </jp>
    </tabs>
    <sections>
        <jp_coupon translate="label" module="jp_coupon">
            <label>jp Coupon </label>
            <tab>jp </tab>
            <frontend_type>text </frontend_type>
            <sort_order>40 </sort_order>
            <show_in_default>1 </show_in_default>
            <show_in_website>1 </show_in_website>
            <show_in_store>1 </show_in_store>
            <groups>
                <general translate="label">
                    <label>General </label>
                    <frontend_type>text </frontend_type>
                    <sort_order>100 </sort_order>
                    <show_in_default>1 </show_in_default>
                    <show_in_website>1 </show_in_website>
                    <show_in_store>1 </show_in_store>
                    <fields>
                        <config_item1 translate="label">
                            <label>Config Item 1 </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>
                        </config_item1 >
                        <config_item2 translate="label">
                            <label>Config Item 2 </label>
                            <frontend_type>text </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>
                        </config_item2 >
                    </fields>
                </general>
            </groups>
        </jp_coupon>
    </sections>
</config>

2. app/code/local/Jp/Coupon/ect/adminhtml.xml 文件

设置jp_coupon配置页面的访问权限

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
<config>
    <acl>
        <resources>
            <admin>
                <children>
                    <system>
                        <children>
                            <config>
                                <children>
                                    <jp_coupon translate="title" module="jp_coupon">
                                        <title>jp Coupon </title>
                                    </jp_coupon>
                                </children>
                            </config>
                        </children>
                    </system>
                </children>
            </admin>
        </resources>
    </acl>
</config>

3. 清除Magento缓存,重新登录

如果您觉得阅读本文对您有帮助,欢迎转载本文,但是转载文章之后必须在文章页面明显位置保留此段声明,否则保留追究法律责任的权利。

作  者:www.jpdou.top

原文链接:http://www.jpdou.top/add-config-in-magento/

转载于:https://www.cnblogs.com/jpdoutop/p/add-config-in-magento.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值