简体   繁体   English

如何执行自定义模块启用/禁用无法在管理员中工作-Magento

[英]How to do the custom module enable/disable not working in admin - Magento

Initially I am newbie to magento. 最初,我是magento的新手。 So please help me to learn magento. 因此,请帮助我学习magento。 I have created a custom module named 'card voucher'. 我创建了一个名为“卡券”的自定义模块。 I need to enable or disable the module form adminpanel. 我需要启用或禁用模块表单adminpanel。 So I created system.xml on 所以我在上创建了system.xml

My app/code/community/card/voucher/etc/system.xml. 我的应用程序/代码/社区/卡/凭证/etc/system.xml。 The code is shown below 代码如下所示

<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>

Then I disabled the module but still live on my site. 然后,我禁用了该模块,但仍保留在我的网站上。 I think this code is only enough to establish this feature. 我认为此代码仅足以建立此功能。

Please help me as soon as possible 请尽快帮我

Thanks 谢谢

Normally you would want to disable the module functionality and not the module itself from system config. 通常,您将要禁用模块功能,而不是从系统配置中禁用模块本身。

What exactly does this module do? 该模块的作用是什么?

In you code 在你的代码

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

}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM