I have a small piece of code in a template file that I ONLY want to run if a certain module is installed. I found the below code, which you can use to find if a module is active, but I want to know if a module is installed.
$modules = Mage::getConfig()->getNode('modules')->children();
$modulesArray = (array)$modules;
if($modulesArray['Mage_Paypal']->is('active')) {
echo "Paypal module is active.";
} else {
echo "Paypal module is not active.";
}
I’m thinking I could maybe get a list of names of all the modules that are installed, and then use
if (stristr($modulelist, 'Name_Extension'))
to show my code only if the referenced extension is installed.
Anyone any ideas how to do that? Or any better solutions?
Try this: