如何在magento图层导航中更改类别过滤器位置

use*_*790 2 magento magento-1.7

我正在使用magento 1.7,

我在类别页面的左侧边栏上有四个过滤器.

它们被列为

分类品牌尺寸颜色.

我想改变类别和品牌的位置,我希望品牌首先定位如下.

品牌类别大小颜色.

我怎样才能做到这一点

Raj*_*jan 5

打开在分层导航中使用的属性,并在字段/文本框中添加位置值在"前端"属性下.

根据您的要求放置头寸.

然后重新索引.

如果要设置类别过滤器位置,请按照下列步骤操作:

复制文件:app\code\core\Mage\Catalog\Block\Layer\View.php 粘贴文件:app\code\local\Mage\Catalog\Block\Layer\View.php

然后更新app\code\local\Mage\Catalog\Block\Layer\View.php文件代码.

getFilters()用以下代码替换功能代码:

public function getFilters()
{
    $filters = array();
    $catFilters = array(); // Created New array
    if ($categoryFilter = $this->_getCategoryFilter()) {
        $catFilters[] = $categoryFilter; // Assign category to new array
    }

    $filterableAttributes = $this->_getFilterableAttributes();
    foreach ($filterableAttributes as $attribute) {
        $filters[] = $this->getChild($attribute->getAttributeCode() . '_filter');
    }

    /* Pushed category filter array to position 1, if want to change position then update value in this function. */
    array_splice( $filters, 1, 0, $catFilters ); 
    return $filters;
}
Run Code Online (Sandbox Code Playgroud)

希望它会有所帮助!