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.

About these ads

Speak Your Mind

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

%d bloggers like this: