Reputation: 193
I'm trying to override in the local folder a module which is in the local folder also, but I don't know if it's possible. This is what I've done.
I've created /local/Mycompany/Modulename/Model/Model.php which i'd like to override the /local/Othercompany/Modulename/Model/Model.php
my model.php is:
class Mycompany_Modulename_Model_Model extends Othercompany_Modulename_Model_Model
{ ... }
and my config.xml
<global>
<models>
<othercompanymodulename>
<rewrite>
<model>Mycompany_Modulename_Model_Model</model>
</rewrite>
</othercompanymodulename>
</models>
The class is been instantiated whith Mage::getModel('othercompanymodulename/model')
My Mycompany_Mymodule.xml
<config>
<modules>
<Mycompany_Modulename>
<active>true</active>
<codePool>local</codePool>
<depend>
<Othercompany_Modulename/>
</depend>
</Mycompany_Modulename>
</modules>
But my module is ignored. Is possible to override in local folder a class located also in local folder? What I'm doing wrong?
Upvotes: 3
Views: 6274
Reputation: 4879
If i'm right you missed an underscore in the definition of the overwritten model in your config.xml:
<global>
<models>
<othercompany_modulename>
<rewrite>
<model>Mycompany_Modulename_Model_Model</model>
</rewrite>
</othercompany_modulename>
</models>
</global>
Upvotes: 1
Reputation: 1926
It's probably an extension conflicts.
How to check and resolve:
How do I resolve conflicts? You have 3 choices for resolving conflicts:
Read more: http://www.webshopapps.com/blog/2010/11/resolving-magento-extension-conflicts/ Related: Magento - Model Override Not Working in local codePool
Upvotes: 0
Reputation: 2443
open your [magento]\app\etc\modules\Mycompany_Modulename.xml
<?xml version="1.0"?>
<config>
<modules>
<Mycompany_Modulename>
<active>true</active>
<codePool>local</codePool>
<depends>
<Othercompany_Modulename/>
</depends>
</Mycompany_Modulename>
</modules>
</config>
above code force Othercompany_Modulename
to load first.
hope this help you
Upvotes: 6