0

在我的一个类别页面上有一些布局 xml,我无法让最后一行工作

<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/filter.phtml,但它不起作用。我检查了我的默认值category.xml,以确保我引用了正确的名称,before但没有运气。

目录.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>
4

1 回答 1

1

我将假设您的布局块实际上看起来像这样

<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>    

因此,虽然您对块的特定语法

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

可能没问题,因为您将它直接放在catalog_category_view手柄下方,Magento 不知道将块放在哪里。这意味着它要么忽略它,要么块被实例化但没有插入任何地方。

于 2012-12-11T00:35:23.040 回答