i am writing my extension and i have troubles in my extension layout xml file. I need override my_theme/catalog/product/list.phtml to my_theme/myextension/mylist.phtml

I am trying to write the next code:

<?xml version="1.0"?>
<layout version="0.1.0">
         <reference name="catalog_product_list">
             <action method="setTemplate">

But this no working. Help me please

  • Welcome to Magento.SE! Unfortunately as it stands this question is vague and requires a lot more information for us to help you. Please provide all relevant code as well as the desired outcome/effect that you're looking to achieve. Thanks!
    – philwinkle
    Jul 23, 2014 at 20:48
  • It would be helpful if you check your question, after posting, if you don't see the code, we don't see the code ;-) Jul 23, 2014 at 21:25

1 Answer 1


To call methods on a block, you have to make sure two things:

  1. the block exists, when you try to call a method on it.
  2. you use the name of the block.

e.g. here:

<catalog_category_default translate="label">
    <reference name="content">
        <block type="catalog/category_view" name="category.products" template="catalog/category/view.phtml">
            <block type="catalog/product_list" name="product_list" template="catalog/product/list.phtml">

The name is product_list not catalog_product_list. And in the layered_navigation block it is product_list too, so change the reference and it should work

  • Still I have a doubt. We need to ensure the extension should load after Mage_Catalog loads right ? Otherwise there would be a chance to override again our custom template. Since Mage_Catalog is setting default template for this block. What would you think ? Am I right ? Jul 24, 2014 at 6:10
  • You have to be sure, that the block exists and that there is no other setTemplate call after yours but I think this i not the case. The block is created, the template set and then your layout.xml is parsed. So as long as you have no problems, don't think about it ;-) Jul 24, 2014 at 6:40
  • I didn't see the layout.xml mentioning. He mentioned just layout xml. I "parsed" it in a general sense. What I understood from that is he has a layout xml file for his extension. It may be layout.xml or his own extension_layout.xml. That is why I asked. what if he has custom layout file for his extension? Does my question has any relevance in that case ? Jul 24, 2014 at 6:57
  • ah ok. Just have a look into the file whether he has an <action> node in it. if yes, you can <depend> on his module, then your layout.xml is parsed after his. But only, if you use the same or a later update handle like catalog_category_default if you use an earlier one, you can't do anything except to change the handle Jul 24, 2014 at 7:38
  • if yes, you can <depend> on his module, then your layout.xml is parsed after his. I dint get this point. I am not talking about my extension. I only talking about the extension that is in question. Suppose extension contains a frontend layout definition in its config file. Let the file mentioned be foo.xml. I think he can use this layout file for setting template for product-list block. In that case, my question has any relevance ? Jul 24, 2014 at 7:45

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.