4

I've created a small module

app/code/local/Mycompany/Managa/config.xml

  <?xml version="1.0" encoding="UTF-8"?>

<config> 

<modules>
    <Mycompany_Managa>
        <version>0.1.0</version>
    </Mycompany_Managa>
</modules>

<global>
    <models>
        <mana_filters>
            <rewrite>
                   <managa>Mycompany_Managa_Filters_Model_Filter_Attribute</managa>
            </rewrite>
        </mana_filters>
    </models>
</global>

</config>

app/code/local/Mycompany/Managa/Filters/Model/Filter/Attribute.php

  class Mycompany_Managa_Filters_Model_Filter_Attribute extends Mana_Filters_Model_Filter_Attribute
{
  //exact copy of Mana_Filters_Model_Filter_Attribute
 }

app/etc/modules/Mycompany_Managa.xml

  <?xml version="1.0" encoding="UTF-8"?>
 <config>
 <modules>
    <Mycompany_Managa>

        <active>true</active>

        <codePool>local</codePool>

        <depends>
            <Mana_Filters/>
        </depends>

    </Mycompany_Managa>
</modules>


</config>

The file that I'm trying to override is located at /app/code/local/Mana/Filters/Model/Filter/Attribute.php and as mentioned above it has a class - Mana_Filters_Model_Filter_Attribute.

I assume it's something to do with my config file but no matter what I do I can't seem to get the site to use my version of the model. I've followed other questions with similar questions such as - one,two and three, but I'm obviously doing something wrong.

1 Answer 1

5

there are lot of issue on you code

1. Folder Structure ISSUE:

There are only two folder Upto Model folder:

Need change folder stucture

From:

Mycompany/Managa/Filters/Model/Filter/Attribute.php

TO:

Mycompany/Managa/Model/Filter/Attribute.php

Need to change at Class name accordingly:

Mycompany_Managa_Filters_Model_Filter_Attribute

TO

Mycompany_Managa_Model_Filter_Attribute

2.Third Party Model Prefix issue:

You need to checked first Mana_Filters Model prefix:

in Mana_Filters Config.xml check models prefix.

  <models>
    <model_prefix> <!-- This is call  Model Prefix -->
        <class>Mana_Filters</class>
    </model_prefix> <!-- This is call  Model Prefix -->
    </models>

Config.xml

<global>
    <models>
        <mana_filters> <!-- Check  Manadev Filter Prefix -->
            <rewrite>
                   <filter_attribute>Mycompany_Managa_Model_Filter_Attribute</filter_attribute>
            </rewrite>
        </mana_filters>
    </models>
</global>
2
  • Thanks for the answer Amit. I've updated the model path and class. Also changed the reference in the config.xml to match the new class name. mana_filters is also correct but it's still not working Feb 10, 2015 at 13:25
  • 1
    Ignore that, i posted it before your last update. Thank you! This works a treat. Feb 10, 2015 at 13:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.