Showing posts with label function rewrite in magento. Show all posts
Showing posts with label function rewrite in magento. Show all posts

Sunday, 13 November 2011

Magento Block Over ride

Here i am going to over ride catalog layer view  [Mage_Catalog_Block_Layer_View]
Config.xml file need to same as that of below.
<?xml version="1.0"?>
<config>
    <modules>
        <Modulename_Catalog>
            <version>0.1.0</version>
        </Modulename_Catalog>
    </modules>
    <global>
        <blocks>
            <modulename_catalog>
                <class>Modulename_Catalog_Block</class>
            </modulename_catalog>
            <catalog>
                <rewrite>
                    <layer_view>Modulename_Catalog_Block_Layer_View</layer_view>
                </rewrite>
            </catalog>
        </blocks>
    </global>
</config>

Then you need to create a class file [Class Modulename_Catalog_Block_Layer_View]  with the function you need to over ride .
No need to change the function name because the system and the config will automatically override the previous one.

Using the above same way you can rewrite models also.