Magento后端未显示新选项卡

时间:2015-08-28 15:55:33

标签: magento module tabs admin backend

我在app / code / local / [Namespace] / [Module] / etc目录下创建了我的system.xml,但它似乎无法正常工作。

据我所知,选项卡的相同名称必须是我在该部分的tab标签中放置的名称,而且我的config.xml文件中也已经有了acl配置。

有人可以帮我这个吗?

<config>
<tabs>
    <minimum translate="label" module="minimum">
        <label>Ari Modules</label>
        <sort_order>10</sort_order>
    </minimum>
</tabs>
<sections>
    <minimum translate="label" module="minimum">
        <label>Minimum Shop Amount</label>
        <tab>minimum</tab>
        <frontend_type>text</frontend_type>
        <sort_order>10</sort_order>
        <shown_in_default>1</shown_in_default>
        <shown_in_website>1</shown_in_website>
        <shown_in_store>1</shown_in_store>
        <groups>
            <general translate="label" module="minimum">
                <label>Configuration</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>
                <fields>
                    <yes_no_active translate="label">
                        <label>Active</label>
                        <frontend_type>select</frontend_type>
                        <source_model>adminhtml/system_config_source_yesno</source_model>
                        <sort_order>00</sort_order>
                        <show_in_default>1</show_in_default>
                        <show_in_website>1</show_in_website>
                        <show_in_store>1</show_in_store>
                    </yes_no_active>
                    <minimum_amount translate="label">
                        <label>Minimum shopping amount</label>
                        <frontend_type>text</frontend_type>
                        <sort_order>01</sort_order>
                        <show_in_default>1</show_in_default>
                        <show_in_website>1</show_in_website>
                        <show_in_store>1</show_in_store>
                    </minimum_amount>
                    <minimum_message translate="label">
                        <label>Message to show if the minimum shopping amount is not met</label>
                        <frontend_type>textarea</frontend_type>
                        <sort_order>02</sort_order>
                        <show_in_default>1</show_in_default>
                        <show_in_website>1</show_in_website>
                        <show_in_store>1</show_in_store>
                    </minimum_message>
                </fields>
            </general>
        </groups>
    </minimum>
</sections>

这是我的config.xml

<config>
<modules>
    <Ari_Minimum>
        <version>0.1.0</version>
    </Ari_Minimum>
</modules>
<global>
    <models>
        <minimum>
            <class>Ari_Minimum_Model</class>
        </minimum>
    </models>
    <helpers>
        <minimum>
            <class>Ari_Minimum_Helper</class>
        </minimum>
    </helpers>
</global>
<default>
    <ari>
        <general>
            <yes_no_active>0</yes_no_active>
            <minimum_amount>1500</minimum_amount>
            <minimum_message><![CDATA[The minimum shopping amount is %s euros]]></minimum_message>
        </general>
    </ari>
</default>
<frontend>
    <events>
        <sales_quote_save_after>
            <observers>
                <ari_minimum_verifyminimum>
                    <type>singleton</type>
                    <class>Ari_Minimum_Model_Observer</class>
                    <method>verifyMinimum</method>
                </ari_minimum_verifyminimum>
            </observers>
        </sales_quote_save_after>
    </events>
</frontend>

1 个答案:

答案 0 :(得分:0)

<?xml version="1.0" encoding="UTF-8"?>
<config>
<tabs>
    <ari translate="label" module="minimum">
        <label>Ari Modules</label>
        <sort_order>10</sort_order>
    </ari>
</tabs>
<sections>
    <minimum translate="label" module="minimum">
        <label>Minimum Shop Amount</label>
        <tab>ari</tab>
        <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>

        <groups>
            <general translate="label" module="minimum">
                <label>Configuration</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>
                <fields>
                    <yes_no_active translate="label">
                        <label>Active</label>
                        <frontend_type>select</frontend_type>
                        <source_model>adminhtml/system_config_source_yesno</source_model>
                        <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>
                    </yes_no_active>
                    <minimum_amount translate="label">
                        <label>Minimum shopping amount</label>
                        <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>
                    </minimum_amount>
                    <minimum_message translate="label">
                        <label>Message to show if the minimum shopping amount is not met</label>
                        <frontend_type>textarea</frontend_type>
                        <sort_order>30</sort_order>
                        <show_in_default>1</show_in_default>
                        <show_in_website>1</show_in_website>
                        <show_in_store>1</show_in_store>
                    </minimum_message>
                </fields>
            </general>
        </groups>
    </minimum>
</sections>

然后在模块的etc /文件夹

上创建一个名为adminhtml.xml的文件
<config>
<acl>
    <resources>
        <admin>
            <children>
                <system>
                    <children>
                        <config>
                            <children>
                                <minimum translate="title" module="minimum">
                                    <title>Ari Minimum</title>
                                    <sort_order>999</sort_order>
                                </minimum>
                            </children>
                        </config>
                    </children>
                </system>
            </children>
        </admin>
    </resources>
</acl>

退出并删除您的缓存存储并尝试,您编写了shown_in_ *而不是show_in _ *

另外,在config .xml上,请改用

<default>
    <minimum>
            <general>
                <yes_no_active>0</yes_no_active>
                <minimum_amount>1500</minimum_amount>
                <minimum_message><![CDATA[The minimum shopping amount is %s euros]]></minimum_message>
            </general>
    </minimum>
</default>

希望这有帮助