Sometimes we are required to do some changes in our core phtml files. Its a good habit of every Magento programmer to override the core file instead of the making change in the core file.
To do so overriding the core file can be done as :
Step 1
Under your local folder, create a new folder in the path /app/local/Over/Ride. In that folder make a file config.xml in etc folder with the below code :
<?xml version="1.0" encoding="UTF-8"?>
<config>
<modules>
<Over_Ride>
<version>0.0.1</version>
</Over_Ride>
</modules>
<frontend>
<layout>
<updates>
<Over_Ride>
<file>Ride.xml</file>
</Over_Ride>
</updates>
</layout>
</frontend>
</config>
Step 2
Create Over_Ride.xml under app/design/frontend/base/default/layout with the code :
<?xml version="1.0"?>
<layout version="0.1.0">
<catalog_category_layered translate="label">
<reference name="catalog.leftnav">
<action method="setTemplate">
<template>Ride/layer/view.phtml</template>
</action>
</reference>
</catalog_category_layered>
</layout>
In the above code we are telling magernto to use view.phtml file which we are overriding instead of core file
Step 3
Now Create module file in /etc/modules/Over_Ride.xml. This step is most important step.
write the below code in ti:
<Over_Ride>
<active>true</active>
<codePool>local</codePool>
</Over_Ride>
In this way finally the core layout phtml file gets override.
0 Comment(s)