ajameswolf
ajameswolf

Reputation: 1660

How To Disable Module Per Theme Via Xml in Magento

I was hoping to find a way to disable particular extensions on a theme by theme basis?

Hypothetical scenario: I would like to develop a mobile theme for my existing magento website. The site has a number of extensions that don't play well with my mobile design.

Instead of re-working all of their css/template files I'd prefer just to revert back to magento's defaults.

Is there a way perhaps within /design/frontend/mypackage/ where I can disable those extensions?

Upvotes: 2

Views: 1177

Answers (3)

Swapna Taru
Swapna Taru

Reputation: 688

You can disable the module in local.xml. Just paste the following xml code in your theme's local.xml.

<config>
    <modules>
        <[Your_Module_Name]>
            <active>false</active>
        </[Your_Module_Name]>
    </modules>
</config>

Upvotes: 0

Gerard de Visser
Gerard de Visser

Reputation: 8060

It's not possible to disable module on a theme basis.

However you can prevent your module code from being executed by checking the actual package/theme. It's clearly a workaround and not very elegant, but it does work.

E.g. following code within your module:

<?php
$packageName = Mage::getSingleton('core/design_package')->getPackageName();
$themeName = Mage::getSingleton('core/design_package')->getTheme('frontend');

if ($themeName != 'MobileThemeName') {
    // Your module code
}

Upvotes: 1

Dushyant Joshi
Dushyant Joshi

Reputation: 3702

You can not disable extension per store/theme. However you can disable output generated by that extension by going to

Configuration > Current Configuration Scope > Advanced > Advanced > Disable Module Output

This action only disables module output as it says. If your module uses, let’s say some Observer functionality to hook into some part of the system and does some overriding then those actions won’t be disabled.

To fully disable module, you need to go to module config file, like /etc/ActiveCodeline_MyModule.xml, and set it’s active parameter to false, like:

<config>
    <modules>
        <activecodeline_mymodule>
            <active>false</active>
            <codepool>local</codepool>
        </activecodeline_mymodule>
    </modules>
</config>

More information How to fully disable (turn off) Magento module & Disable Magento extention/module on mobile theme

Upvotes: 0

Related Questions