cancel
Showing results for 
Search instead for 
Did you mean: 

Overriding core stuff

SOLVED

Overriding core stuff

Hi!

 

I'm trying to override app/code/core/Mage/Catalog/Model/Layer/Filter/Category.php. In order to do that, I've created app/code/local/Utopia/Catalog/Model/Layer/Filter directory and copied the Category.php there.

 

Then I've created /app/etc/modules/Utopia_Catalog.xml with this code in it:

 

< ?xml version="1.0"?>  
<config>  
    <modules>  
        <Utopia_Catalog>  
            <active>true</active>  
            <codepool>local</codepool>        
        </Utopia_Catalog>  
    </modules>  
</config> 

And finally created app/code/local/Utopia/Catalog/etc/config.xml file and put this code there:

 

<?xml version="1.0"?>
<config>
    <modules>
        <Utopia_Catalog>
            <version>0.0.1</version>
        </Utopia_Catalog>
    </modules>
    <global>
        <blocks>
           <Utopia_Catalog>
                <class>Utopia_Catalog_Block</class> <!--this is a new block page for that custom module-->
            </Utopia_Catalog>            
            <catalog>
                <rewrite>
                    <layer_filter_category>Utopia_Catalog_Block_Layer_Filter_Category</layer_filter_category>
                </rewrite>
            </catalog>
        </blocks>
    </global>
</config>

But it doesn't take my code from app/code/local/Utopia/Catalog/Model/Layer/Filter/Category.php it keeps using the original Category.php.

 

Any ideas what I'm doing wrong?

 

Thanks a lot.

 

3 REPLIES

Re: Overriding core stuff

its correct., try refresh config cache

Re: Overriding core stuff

An evil lurks in the heart of Magento, in the module XML control file =>

<codepool>local</codepool>

needs to be

 

<codePool>local</codePool>

Camel Case ticks me off sometimes, the P needs to be capitalized.

Re: Overriding core stuff

Thank you everyone for the support. I luv this community and I think this Magneto thing is awesome!!

(Yes, I know I wrote Magneto, I like to call it that)

 

And BTW the final working code is:

 

/app/etc/modules/Utopia_Catalog.xml

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

 

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

<?xml version="1.0"?>
<config>
    <modules>
         <Utopia_Catalog>
            <version>0.0.1</version>
        </Utopia_Catalog>
    </modules>
    <global>
        <models>
            <catalog>
                <rewrite>
                    <layer_filter_category>Utopia_Catalog_Model_Layer_Filter_Category</layer_filter_category>
                </rewrite>
            </catalog>
        </models>
   </global>
</config>