Magento: can two modules extend the same base model?

Is it possible to create two modules that extend the same base model, for example Mage_Customer_Model_Customer ?

What will I get when I access the (overloaded) base model?

+4
source share
1 answer

You can extend the Model class to custom models:

 class Namespace_Module_Model_Customer1 extends Mage_Customer_Model_Customer 

defined in app / code / local / Namespace / Customer / Model / Customer1.php and:

 class Namespace_Module_Model_Customer2 extends Mage_Customer_Model_Customer 

defined in application / code / local / namespace / Customer / Model / Customer 2.php.

which should be good - you will need to indicate which model you want when you name it:

 Mage::getModel('namespace/customer1')->method() 

or

 Mage::getModel('namespace/customer2')->method() 

base model will not change:

 Mage::getModel('customer/customer') 
+4
source

Source: https://habr.com/ru/post/1344136/


All Articles