Skip to content

Instantly share code, notes, and snippets.

@oscar-reales-interactiv4
Created September 15, 2011 11:57
Show Gist options
  • Select an option

  • Save oscar-reales-interactiv4/1219072 to your computer and use it in GitHub Desktop.

Select an option

Save oscar-reales-interactiv4/1219072 to your computer and use it in GitHub Desktop.
Magento: 2 maneras de saber si un módulo esta activo / enabled
<?php
//manera que utilizan muchas extensiones, aunque no es la recomendable,
//ya que magento incluye esta funcionalidad en su core
$modules = Mage::getConfig()->getNode('modules')->children();
$modulesArray = (array)$modules;
if($modulesArray['Module_Name']->is('active')) {
echo "module is active.";
} else {
echo "module is not active.";
}
//y la manera "magento":
if(Mage::helper('core')->isModuleEnabled('Module_Name'))
{
//codigo si modulo esta activo
}
//y una tercera manera aportada por @barbanet
Mage::getConfig()->getModuleConfig('Module_Name')->active;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment