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

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

October 16, 2026 · Illustrated author avatarBy Stefan Bogdanescu
How to do the custom module enable/disable not working in admin - Magento

Enabling and Disabling Custom Modules in Magento

Hello fellow developers! Today we’re going to tackle an interesting question about enabling and disabling custom modules in Magento. Our friend here is new to Magento and has created a module named ‘card voucher’, but the enable/disable functionality isn’t working as expected from the admin panel.

Understanding the Issue with Custom Module Enabling/Disabling

When you create a custom module, part of the standard workflow involves setting it up so that admins can easily enable or disable its features. This is typically done by creating an XML configuration file located at app/code/community/{Vendor}/{Module}/etc/system.xml.

In our friend’s case, they have this system.xml in place for their card voucher module:

<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. 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>
</config>

At first glance, this XML file seems correct. It defines a new tab for the card voucher module, under which there is one section called ‘Enable / Disable’. Within that section, there’s a field named active of type select with options defined by the adminhtml/system_config_source_enabledisable model.

Why the Custom Module Enable/Disable Issue Persists

So why isn’t this working? There are a couple of common reasons for this issue:

  1. Module Not Disabled Properly in app/etc/modules: Even if you’ve created the system.xml file correctly, you need to ensure that your module is actually disabled in the app/etc/modules directory.

    You should have an XML file for your module there (e.g., Card_Voucher.xml), and it should contain something like this:

    <?xml version="1.0"?>
    <config>
        <modules>
            <Card_Voucher>
                <active>true</active>
                <codePool>community</codePool>
                <depends/>
            </Card_Voucher>
        </modules>
    </config>
    

    If the active tag is set to true, your module is enabled. Change it to false to disable.

  2. Cache Issues: Magento has a caching system that can sometimes prevent changes from immediately appearing in the admin panel after enabling or disabling modules.

    You should clear all caches (under System > Cache Management) after making these changes.

  3. Permissions and Ownership: Ensure that the appropriate permissions are set on your module files and directories. They need to be writable by the Magento process owner.

Best Practices for Custom Module Enabling/Disabling

Remember, enabling or disabling a custom module is not about just creating a system.xml file—it’s an overall process that involves many components of the Magento architecture. Always follow these best practices:

  • Make sure your module is properly registered in app/etc/modules.
  • Ensure all necessary PHP files and XML configuration files are created correctly.
  • Use clear, descriptive names for your modules to avoid confusion with core or other third-party extensions.
  • Document your module clearly so others (and future you) can understand what it does and how to configure it.

Conclusion

Enabling and disabling custom modules in Magento is a fundamental part of extension development. It requires careful attention to both XML configuration files and the underlying PHP logic that drives them.

Remember, a well-documented module with clear functionality is a joy for developers to work with. We hope this guide helps you navigate the world of custom modules and enables/disables them effectively in your Magento projects!

If you’re looking for more advanced tips on Magento development, feel free to check out our other tutorials at LaravelCompany. Happy coding!

API Extensions Admin Configuration

Our network