Home » Php » php – Determine if Magento module is enabled

php – Determine if Magento module is enabled

Posted by: admin April 23, 2020 Leave a comment

Questions:

What is the best way to determine if a particular module is enabled/active in Magento? I’ve tried using class_exists to check if my code has been loaded and parsed by PHP but lately I’ve noticed its pretty unreliable (returns true even when I delete the module’s .xml configuration).

Is there a core function I can call?

How to&Answers:

If you would like to use a build in function just use

Mage::helper('core')->isModuleEnabled(<module name>);

It is implemented in

Mage_Core_Helper_Abstract

Answer:

Here’s another option that is a more elegant way of finding out the status:

Mage::getConfig()->getModuleConfig('modulename')->is('active', 'true')