Force your Magento module to be installed after the default ones

Sometimes you absolutely want your module to be installed after the default ones defined in Magento. You have propably tried to play with the dependencies between modules, but this has no impact on the prioritization of modules. Here is a little code snippet to keep Magento default installation and to install your module afterwards.

Default setup override

app/code/local/Namespace/MyModule/etc/config.xml :

<?xml version="1.0"?>

Our module setup

app/code/local/Namespace/MyModule/Model/Resource/Setup.php :

class Namespace_MyModule_Model_Resource_Setup extends Mage_Core_Model_Resource_Setup
    public function applyUpdates()
        if (!Mage::isInstalled()) {
            $modules = Mage::getConfig()->getNode('modules')->children();
            $myModule = substr(__CLASS__, 0, strpos(__CLASS__, '_Model'));
            foreach ($modules as $moduleName => $moduleNode) {
                if ($moduleName != $myModule) {
            return $this;
        return parent::applyUpdates();

If you install Magento from cli (install.php script), clean the cache so that your module is installed. With the installation from the web interface, a click on “Go to Backend” should be enough. “

One Response to “Force your Magento module to be installed after the default ones”

  1. Frank says:

    Hi, you put me in the right direction


    But I have some optimizations for your code.
    You can find it here:

Leave a Reply

* Required fields