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:
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.
will always get you E2 instantiation, but you can use
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.