1

我在类别页面上的类别描述之后放置一个块时遇到问题。

我有一个单独的布局 xml 文件,用于新的过滤导航。xml是:

 <catalog_category_layered> 
    <remove name="catalog.leftnav" />
    <remove name="enterprisecatalog.leftnav"/> 
    <reference name="left">
       <block type="amshopby/catalog_layer_view" name="amshopby.navleft" after="currency" template="catalog/layer/view.phtml"/>
    </reference>
    <reference name="content">
            <block type="amshopby/catalog_layer_view_top" name="amshopby.navtop" before="-" template="amshopby/view_top.phtml"/>
            <block type="amshopby/top" name="amshopby.top" before="category.products" template="amshopby/top.phtml"/>
    </reference>
</catalog_category_layered> 

因此,正是这一行将此块放置在我的类别页面内容区域的开头:

<block type="amshopby/catalog_layer_view_top" name="amshopby.navtop" before="-" template="amshopby/view_top.phtml"/>

所以现在我的分类页面是这样的:

过滤导航 -> 分类标题 -> 分类描述 -> 产品概览

但我想重新排列它,使它看起来像

分类标题 -> 分类描述 -> 过滤导航 -> 产品概览

但是我怎样才能在描述之后放置这个块呢?这是一个包含标题、描述、产品等的新块:

(标准目录.xml)

 <catalog_category_layered translate="label">
    <label>Catalog Category (Anchor)</label>
    <reference name="left"></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> 

我真的不知道如何在类别描述之后添加这个块。我是 magento 的新手,块系统很混乱。我试过像

<block type="amshopby/catalog_layer_view_top" name="amshopby.navtop" before="product_list_toolbar" template="amshopby/view_top.phtml"/>

但这不起作用。我也尝试在 catalog.xml 中添加这个块代码,但它没有显示出来。

有人知道我能做什么吗?谢谢您的帮助!

4

1 回答 1

3

amshopby.xml中,剪切以下 XML 行:

<block type="amshopby/catalog_layer_view_top" name="amshopby.navtop" before="-" template="amshopby/view_top.phtml"/>
<block type="amshopby/top" name="amshopby.top" before="category.products" template="amshopby/top.phtml"/>

然后在 中catalog.xml,将这两行粘贴到此处:

<catalog_category_layered translate="label">
<!-- ... -->
<reference name="content">
<!-- ... -->
<block type="catalog/category_view" name="category.products" template="catalog/category/view.phtml">

<!-- paste XML here -->

<!-- ... -->
</reference>
</catalog_category_layered>

然后在template/catalog/category/view.phtml这一行粘贴:

<?php echo $this->getChildHtml('amshopby.navtop'); ?>

在以下之后:

<?php if($_description=$this->getCurrentCategory()->getDescription()): ?>
<div class="category-description std">
    <?php echo $_helper->categoryAttribute($_category, $_description, 'description') ?>
</div>
<?php endif; ?>

那应该这样做。

于 2012-09-28T12:46:55.220 回答