By now we probably have all heard that when installing multiple Magento extensions they can clash. Essentially when both extensions try to rewrite the same core model or block only one gets through.
In an attempt to not only understand the cause but also the outcome I’ve set up a small experiment. I pitted against each other various different extensions which all tried to rewrite the same block. The below table highlights in green who “won”. The second column is always the name of the file inside app/etc/modules.
|Aa_Aa community||Aa_Aa.xml||vs.||Aa_Zz community||Aa_Zz.xml|
|Aa_Aa community||Aa_Aa.xml||vs.||Zz_Aa community||Zz_Aa.xml|
|Aa_Zz community||Aa_Zz.xml||vs.||Zz_Zz community||Zz_Zz.xml|
|Zz_Aa community||Zz_Aa.xml||vs.||Zz_Zz community||Zz_Zz.xml|
|Aa_Aa community||Aa_all.xml||vs.||Aa_Zz community||Aa_all.xml|
|Aa_Aa community||aa_aa.xml||vs.||Zz_Zz community||Zz_Zz.xml|
|Aa_Aa community||aa_aa.xml||vs.||Zz_Zz community||zz_zz.xml|
|Aa_Aa community||Aa_Aa.xml||vs.||Mage_Aa core||Mage_Aa.xml|
|Aa_Aa core||Aa_Aa.xml||vs.||Zz_Zz community||Zz_Zz.xml|
|Aa_Aa local||Aa_Aa.xml||vs.||Zz_Zz community||Zz_Zz.xml|
To sum up my findings:
1.) Extensions are loaded alphabetically
2.) The app/etc/module filename is the most influential factor
3.) It doesn’t matter if your extension is in core, community or local
4.) Mage namespace is always loaded first
The tests were run on an Ubuntu machine. Depending on how the php glob function sorts its output your mileage may vary. To see how the action unfolds live you can add Mage::log($filePath); to lib/Varien/Simplexml/Config.php around line 495 (inside the loadFile() function).
To experiment yourself you can download the files used in my experiments from here: MageBase-Extension_Winners_and_Loosers.zip. You will need to delete the ones not in use / edit some of the xml files if you want to call them from a different codePool. Please let me know in the comments if you are getting different results.
You can override community extensions with local overrides. Say you have a file in
if you copy it to
the local file will be used instead.
Originally published on magebase.com. Copyright © 2010 Magebase - All Rights Reserved.