【问题标题】:Move layered navigation filters after category image在类别图像之后移动分层导航过滤器
【发布时间】:2012-08-07 07:27:37
【问题描述】:

我正在使用 Magento v. 1.6.2.0。我已将类别分层导航过滤器设置为水平显示在我的站点中并使用 1 列页面布局。我还设置了一个类别图像。

因此,当您导航到该类别类别时,目录列表前面的元素按从上到下的顺序显示:

分层导航过滤器 > 类别图像 > 产品网格。

我想把这个顺序改成这个:

类别图像 > 分层导航过滤器 > 产品网格。

我曾尝试修改 catalog.xml 文件,但未能成功:

 ...
 <catalog_category_layered translate="label">
        <label>Catalog Category (Anchor)</label>
        <reference name="left">
            <block type="catalog/layer_view" name="catalog.leftnav" after="currency" template="catalog/layer/view.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"/>

 ...

对此有什么好的建议吗?

【问题讨论】:

    标签: xml magento layout layered-navigation


    【解决方案1】:

    所有这些块都在内容块中,这是Mage_Core_Text_List类型并在他的内容中排序块。您可以在下一个函数中看到这种行为:

    protected function _toHtml()
    {
        $this->setText('');
        foreach ($this->getSortedChildren() as $name) {
            $block = $this->getLayout()->getBlock($name);
            if (!$block) {
                Mage::throwException(Mage::helper('core')->__('Invalid block: %s', $name));
            }
            $this->addText($block->toHtml());
        }
        return parent::_toHtml();
    }
    

    突出显示

    $this->getSortedChildren()

    因此,该块将在您的内容块中排序。您可以尝试使用 before 和 after 语句订购吗?

    例如:

    <block .... as="layered" after="category.image"/>
    <block .... as="category.image" before="-"/>
    <block .... as="grid.product after="layered"/>
    

    【讨论】:

      猜你喜欢
      • 2014-07-02
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-11-27
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多