How to check Magento module is installed or not?

Hello friends,

In last month I was working on a Magento module which works in the relationship of Magento Call for Price and Magento Partial Payment modules. So before executing the code of developing the module I had to check that Magento Call for Price and Magento Partial Payment modules were installed or not.

To find a code to check whether any Magento module is installed or not, I found a lot of different ways but here I will discuss the one which I had used.

$modules = (array)Mage::getConfig()->getNode('modules')->children();
if (isset($modules['Indies_Callforprice'])) {
    echo 'Indies Call for Price module is installed.';
    if ($modules['Indies_Callforprice']->is('active')) {
        echo 'Indies Call for Price module is active.';
    } else {
        echo 'Indies Call for Price module is not active.';
    }
} else {
    echo 'Indies Call for Price module is not installed.';
}

The above code will check that the specified module has been installed or not and it is active or not. In the code above I have checked whether the Indies_Callforprice module is installed and active or not. Now to use this code you just need to change the name of module, so instead of Indies_Callforprice you need to write your own module name.

Hope this will help you.

Thanks.

Speak Your Mind