2

I want to override Mage_Catalog_Model_Config.

app/code/local/Myname/Catalog/etc/config.xml

<?xml version="1.0"?>

<config>    
    <modules>
        <Myname_Catalog>
            <version>0.1.0</version>
        </Myname_Catalog>
    </modules>

    <global>
        <models>
            <catalog>
                <rewrite>
                    <config>Myname_Catalog_Model_Config</config>
                </rewrite>
            </catalog>
        </models>
    </global>
</config>

app/etc/modules/Myname_Catalog.xml

<?xml version="1.0"?>

<config>
    <modules>
        <Myname_Catalog>
            <active>true</active>
            <codePool>local</codePool>
        </Myname_Catalog>
    </modules>
</config> 

Why on Earth is this not working??

5

You did not define your own model:

Your app/code/local/Myname/Catalog/etc/config.xml should look like this (note the <myname_catalog> section):

<?xml version="1.0"?>

<config>    
    <modules>
        <Myname_Catalog>
            <version>0.1.0</version>
        </Myname_Catalog>
    </modules>

    <global>
        <models>
            <myname_catalog>
                <class>Myname_Catalog_Model</class>
            </myname_catalog>

            <catalog>
                <rewrite>
                    <config>Myname_Catalog_Model_Config</config>
                </rewrite>
            </catalog>
        </models>
    </global>
</config>
0
1

Update your app/etc/modules/Myname_Catalog.xml file like below

 <?xml version="1.0"?>
<config>
<modules>
    <Myname_Catalog>
        <active>true</active>
        <codePool>local</codePool>
    <depends>
            <Mage_Catalog />
        </depends>
    </Myname_Catalog>
</modules>
</config> 
1

Change your below code

<global>
        <models>
            <catalog>
                <rewrite>
                    <config>Myname_Catalog_Model_Config</config>
                </rewrite>
            </catalog>
        </models>
    </global>

to

<global>
    <models>
        <catalog>
        <class>Myname_Catalog_Model</class>
    </catalog>
        <catalog>
        <rewrite>
            <config>Myname_Catalog_Model_Config</config>
        </rewrite>
        </catalog>
    </models>
</global>

If it don't work after changing above code, trying changing your modulename i.e. "catalog" to something else.

0

Update Module tag of your Myname_Catalog.xml inside app/etc/modules:

            <active>true</active>
                <codePool>local</codePool>
            <depends>
                <Mage_Core/>
                <Mage_Eav/>
            </depends>

If it is an Eav Model you creating, else you will need to make it <depend/> on <(AnotherNameSpace_ModuleName) />

<depends>

directives only establish a load order (or error) for module config.xml files

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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