Minas Jean
Minas Jean

Reputation: 107

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

Initially I am newbie to magento. So please help me to learn magento. I have created a custom module named 'card voucher'. I need to enable or disable the module form adminpanel. So I created system.xml on

My app/code/community/card/voucher/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

Upvotes: 2

Views: 2244

Answers (1)

MagePal Extensions
MagePal Extensions

Reputation: 17656

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

}

Upvotes: 1

Related Questions