如何做自定义模块启用/禁用不工作在admin-Magento



最初我是magento的新手。所以请帮我学习魔术。我创建了一个名为"卡片代金券"的自定义模块。我需要从adminpanel启用或禁用模块。所以我在上创建了system.xml

我的应用程序/code/community/card/oucher/etc/system.xml。代码如下所示

<config>
<tabs>
    <myconf translate="label">
        <label>card voucher</label>
        <sort_order>150</sort_order>
    </myconf>
</tabs>
<sections>
    <tab1 translate="label" module="adminhtml">
        <label>Enable / Disable</label>
        <tab>myconf</tab>
        <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>
        <groups>
            <general translate="label comment">
                <label>General</label>
                <sort_order>50</sort_order>
                <show_in_default>1</show_in_default>
                <show_in_website>1</show_in_website>
                <show_in_store>1</show_in_store>
                <comment><![CDATA[This is a <strong>card voucher</strong> Extension used for checking voucher code.<br />You can simply enable disable this extension here. ]]></comment>
                <fields>
                    <active translate="label comment">
                        <label>Enable/Disable</label>
                        <frontend_type>select</frontend_type>
                        <sort_order>54</sort_order>
                        <source_model>adminhtml/system_config_source_enabledisable</source_model>
                        <show_in_default>1</show_in_default>
                        <show_in_website>1</show_in_website>
                        <show_in_store>1</show_in_store>
                    </active>
                </fields>
            </general>
        </groups>
    </tab1>
</sections>

然后我禁用了模块,但仍然住在我的网站上。我认为这个代码只足以建立这个特性。

请尽快帮助我

感谢

通常,您希望从系统配置中禁用模块功能,而不是模块本身。

这个模块到底做什么?

在你的代码

if(Mage::getStoreConfig('sectionName/groupName/active')){
  // run your code
}

最新更新