Magento:类别描述后的显示块

时间:2012-09-27 07:46:08

标签: magento

我在类别页面上的类别说明后面放置一个块是个问题。

我有一个新的过滤导航的分隔布局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"/>

所以现在我的类别页面如下所示:

过滤导航 - &gt;类别标题 - &gt;类别描述 - &gt;产品概述

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

类别标题 - &gt;类别描述 - &gt;过滤导航 - &gt;产品概述

但是如何在描述之后放置这个块呢?这是一个新的块,包括标题,描述,产品等:

(标准catalog.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中添加此块代码,但之后它没有显示。

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

1 个答案:

答案 0 :(得分:2)

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

应该这样做。