|
If you will have two modules, that rewrite the same original module,
the last module loaded will take an effect.
It’s because the later module “rewrite\” declaration will overwrite any previous “rewrite\” of given original module.
So only the last “rewrite\” loaded has any effect.
Modules from your namespace will be loaded in order they appear in your Namespace_All.xml file.
Only way to control the order besides that, is using <depends><Module /></depends>.
In your example it would look like this:
<config> <modules>
<NS_E1> <active>true</active> <codePool>local</codePool> <depends> <Mage_OriginalModuleName/> </depends> </NS_E1> <NS_E2> <active>true</active> <codePool>local</codePool> <depends> <NS_E1 /> </depends> </NS_E2> </modules> </config>
Now simply make sure that E2 extends E1.
Voila, now you can use both E2 and E1 methods, and if E2 is disabled or not installed, E1 will still work.
If you don’t want to extend E1 in E2, you can simply use your E1 module model. You will need to instantiate it your self.
Calling
Mage:getModel("module/model");
will always get you E2 instantiation, but you can use
Mage:getModel("NS_E1_Model_Class_Name");
in this case, Magento will try to load specified class.
Naturraly, this work only until your user will not install 3rd module overriding OriginalModule But for that i don’t have a workaround yet.
|