Steve Robbins
Steve Robbins

Reputation: 13812

Why wont the layout update xml add my block?

On one of my category pages has some layout xml, and I can't get the last line to work

<remove name="breadcrumbs" />

<reference name="head">
    <action method="addCss"><script>css/speakers.css</script></action>
</reference>

<block type="page/html" name="catalog.filter" before="product_list" template="catalog/category/filter.phtml" />

I'm trying to add catalog/category/filter.phtml but it's not working. I've checked my default category.xml to make sure I'm referencing the right name in the before but no luck.

catalog.xml:

<catalog_category_layered translate="label">
    <label>Catalog Category (Anchor)</label>
    <reference name="left">
        <block type="catalog/layer_view" name="catalog.leftnav" before="-" template="catalog/layer/view.phtml"/>
    </reference>
    <reference name="breadcrumbs.container">
        <block type="catalog/category_view" name="category.title" after="breadcrumbs" template="catalog/category/title.phtml"/>
    </reference>
    <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">
                <!-- <action method="addReviewSummaryTemplate"><type>default</type><template>review/helper/su.phtml</template></action> -->
                <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>3</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>
                        <action method="addPagerLimit"><mode>grid</mode><limit>3</limit></action>
                        <action method="addPagerLimit"><mode>grid</mode><limit>6</limit></action>
                        <action method="addPagerLimit"><mode>grid</mode><limit>9</limit></action>
                        <action method="addPagerLimit" translate="label"><mode>grid</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>
</catalog_category_layered>

Upvotes: 0

Views: 1273

Answers (1)

Alana Storm
Alana Storm

Reputation: 166046

I'm going to assume your layout block actually looks like this

<catalog_category_view>
    <remove name="breadcrumbs" />

    <reference name="head">
        <action method="addCss"><script>css/speakers.css</script></action>
    </reference>

    <block type="page/html" name="catalog.filter" before="product_list" template="catalog/category/filter.phtml" />
</catalog_category_view>    

So, while your specific syntax for the block

<block type="page/html" name="catalog.filter" before="product_list" template="catalog/category/filter.phtml" />

is probably OK, since you have it at the level directly under your catalog_category_view handle, Magento doesn't know where to put the block. This means it's either ignoring it, or the block is instantiated but not inserted anywhere.

Upvotes: 1

Related Questions