Magento 1.9 – Overwrite an Already Overwritten Template

magento-1.9moduleoverrides

The product listing page is already overwritten by a module from local codepool provided by theme. [Module name : shopby]

Inside the active theme in design area, layout > shopby.xml i can see this

<reference name="product_list">
     <action method="setTemplate">
         <template>sm/shopby/catalog/product/list.phtml</template>
     </action>
</reference>

I want to take this file list.phtml and make few modifications leaving this file untouched and want to overwrite by another custom module(just to overwrite this file/other technique). Because with this the added modifications will only be applied on active of this module.

Is it possible to overwrite this product listing page as it's already being overwritten ?

Best Answer

That is what local.xml do for you. Create a new file local.xml inside the same design package and then add this code.

File : app\design\frontend\{package}\{theme}\layout\local.xml

<layout>
    <catalog_category_default>
        <reference name="product_list">
             <action method="setTemplate">
                 <template>myupdates/catalog/product/customlist.phtml</template>
             </action>
        </reference>
    </catalog_category_default>
    <catalog_category_layered>
        <reference name="product_list">
             <action method="setTemplate">
                 <template>myupdates/catalog/product/customlist.phtml</template>
             </action>
        </reference>
    </catalog_category_layered>
</layout>

Now create a new template file in the same design package with a directory sturcture app\design\frontend\{package}\{theme}\template\myupdates/catalog/product/customlist.phtml and copy paste all content of the list.phtml to there and do modifications.

Related Topic