2

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 ?

1 Answer 1

5

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.

4
  • Thank you this works. But as i have said in the question, how can i toggle between this two layouts ? (i was thinking about like a module and with enabling and disabling, the product list template files will be applied) so how can i enable/disable this ?
    – Suman K.C
    Commented Aug 13, 2015 at 5:40
  • @K.C. If you want to toggle, you need to comment out this section from local.xml. Otherwise you need to create a module and add same code in your custom layout xml file. So if your module is active, it will use your custom list phtml file. If your module is disabled, then it will go for theme's list.phtml file. Commented Aug 13, 2015 at 5:50
  • @K.C. If the answer helped you to resolve your issue, then you can accept this answer by mark the tick ON thanks Commented Aug 13, 2015 at 5:53
  • ya ya, sure. Exactly via custom module.
    – Suman K.C
    Commented Aug 13, 2015 at 5:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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