Conflicts between modules in Magento

What are conflicts and why do they exists ?

One of the advantages of the Magento platform is its architecture, which allows for almost unlimited expansion possibilities. Our system can be customized to meet your needs with modules that you can find countless, both free and paid.

Modules, extend and/or modify the native Magento functionality. The Magento architecture allows you to write/rewrite any class of model block and helper. Below is the xml code that rewrite the native class Mage_Catalog_Model_Product, class Alekseon_Catalog_Model_Product, so we can change the logic of the class representing the product.


There are conflicts when two (or more) modules rewrite the same class. In that case, the class will only be overwritten by one module, so the rest of the modules will not work properly, which in some cases can have a fatal impact on our platform.

So which module will rewrite the class?

We can not be sure of that. It all depends on the order of load the modules. The class will be rewrite by the module that will be loaded later. However, this order is "accidental", and it might change if we install or remove any module. It is therefore worth taking a moment to take a look whether there is no conflict on Your platform. You may think that everything works as it should, but once the new module has been installed, the order of modules may change, which can be catastrophic!

Does my project have conflicts ? How to avoid them ?

Unfortunately, conflicts are not easy to find. To detect them, check the content of the <rewrite> in the "config.xml" files on all installed modules, which may not be easy and time consuming.

To make this task easier, we recommend our free Modules Conflict Detector module, which will find all rewrites of models, blocks, and helpers, will display them in the grid with information if rewrite causes a conflict.

Good advice that can help prevent conflicts (and more):

  • Do not install everything. More modules mean the higher the risk, especially if the modules have similar functionality, before you install anything it will be worth looking for what you really need.
  • Before installing the module, it is worth checking its code, for example into the file "config.xml", if there are no rewites of classes that we already have overwritten.
  • DO NOT install the module directly on the production server - first on the test environment and test it.
  • Do Backups - modules are easy to install, unfortunately they are not so easy to uninstall

How to solve conflicts ?

There is no single solution for resolving conflicts. In many cases, you have to read the code, and understand "what the author meant." With more complex modules, the help of a specialist will certainly be necessary.


Two modules overwrite the same Mage_Customer_Model_Customer class, but other methods. There is a conflict between the modules, depending on the order in which they are loaded, the native method getName () or validateAddress () will be overwritten.

class Company_ModuleA_Model_Cusomer extends Mage_Customer_Model_Customer
    public function getName()

class Company_ModuleB_Model_Cusomer extends Mage_Customer_Model_Customer
    function validateAddress(array $data, $type = 'billing')

First, let's take a look at the order in which modules are loaded. We will change the declaration of one of the modules in the file "app/etc/modules/*. Xml" - thanks to the <depends> module, we can force ModuleB module to be loaded at a later time than ModuleA:


We now know that ModuleB rewrites the Mage_Customer_Model_Customer class, so the validateAddress() method is overridden, but the getName() method does NOT.
Here we will use class inheritance mechanism, we change the class Company_ModuleB_Model_Cusomer to inherit the class Company_ModuleA_Model_Cusomer.

class Company_ModuleB_Model_Cusomer extends Company_ModuleA_Model_Cusomer
    function validateAddress(array $data, $type = 'billing')

Of course, the company_ModulA_Model_Cusomer class inherits from the native class Mage_Customer_Model_Customer. So a "chain" of classes is created:
Company_ModuleB_Model_Cusomer - Company_ModuleA_Model_Cusomer - Mage_Customer_Model_Customer.
Voilà. Conflict solved !

The above example is the most common conflict. A more complicated case occurs when two modules overwrite the same method. To solve such a conflict, we can also use the above solution, but it should be remembered to preserve the logic and functionality of the method from both modules - this requires understanding of the code and programming skills.