Magento – Category Custom Layout Update XML

categorylayoutlayout-updatexml

I'm trying to use a different phtml file in an layout update for a category for the product_sublist.

Here's the catalog xml:

<reference name="content">
    <block type="catalog/category_view" name="category.products" template="catalog/category/view.phtml">
        <block type="catalog/product_list" name="product_sublist" template="catalog/product/subcatlist.phtml"> 
            <action method="setColumnCount"><count>5</count></action> 
            </block> 
        <block type="catalog/product_list" name="product_list" template="catalog/product/list.phtml">
            <block type="catalog/product_list_toolbar" name="product_list_toolbar" template="catalog/product/list/toolbar.phtml">
                <block type="page/html_pager" name="product_list_toolbar_pager"/>
                <!-- The following code shows how to set your own pager increments -->
                <!--
                    <action method="setDefaultListPerPage"><limit>4</limit></action>
                    <action method="setDefaultGridPerPage"><limit>9</limit></action>
                    <action method="addPagerLimit"><mode>list</mode><limit>2</limit></action>
                    <action method="addPagerLimit"><mode>list</mode><limit>4</limit></action>
                    <action method="addPagerLimit"><mode>list</mode><limit>6</limit></action>
                    <action method="addPagerLimit"><mode>list</mode><limit>8</limit></action>
                    <action method="addPagerLimit" translate="label"><mode>list</mode><limit>all</limit><label>All</label></action>
                -->
            </block>
            <action method="addColumnCountLayoutDepend"><layout>empty</layout><count>6</count></action>
            <action method="addColumnCountLayoutDepend"><layout>one_column</layout><count>5</count></action>
            <action method="addColumnCountLayoutDepend"><layout>two_columns_left</layout><count>4</count></action>
            <action method="addColumnCountLayoutDepend"><layout>two_columns_right</layout><count>4</count></action>
            <action method="addColumnCountLayoutDepend"><layout>three_columns</layout><count>3</count></action>
            <action method="setToolbarBlockName"><name>product_list_toolbar</name></action>
        </block>
    </block>
</reference>

Trying to set in update, product_sublist to subcatlist_hardware.phtml.

Here's what I have and it's not working…

    <reference name="content">
            <block type="catalog/product_list" name="product_sublist" template="catalog/product/subcatlist_hardware.phtml"> 
                </block> 
    </reference

What am I missing or doing wrong?

Best Answer

If you just want to change the template for the product_list which based on the comments above I think is what your trying to achieve you can just reference the original name and then set a new template file name.

In your local.xml under whatever layout handle .eg <catalog_category_layered> you want this to update on you can do this:

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

If you want to do this from the backend it's the same apart from you don't need to wrap a layout handle around the code.

enter image description here