Created
September 15, 2011 11:57
-
-
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?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