如何在magento图层导航中更改类别过滤器位置
我使用的是magento 1.7 我有四个过滤器在分类页面左侧栏的图层上 它们被列为 分类品牌大小颜色 我想改变类别和品牌定位,我想让品牌首先定位,如下所示 品牌类别大小颜色如何在magento图层导航中更改类别过滤器位置,magento,magento-1.7,Magento,Magento 1.7,我使用的是magento 1.7 我有四个过滤器在分类页面左侧栏的图层上 它们被列为 分类品牌大小颜色 我想改变类别和品牌定位,我想让品牌首先定位,如下所示 品牌类别大小颜色 如何做到这一点打开分层导航中使用的属性,前端属性下有字段/文本框可添加位置值 根据您的要求放置位置 然后再重新编制索引 如果要设置类别过滤器位置,请执行以下步骤: 复制文件:app\code\core\Mage\Catalog\Block\Layer\View.php 粘贴文件:app\code\local\Mage\Ca
如何做到这一点打开分层导航中使用的属性,前端属性下有字段/文本框可添加位置值 根据您的要求放置位置 然后再重新编制索引 如果要设置类别过滤器位置,请执行以下步骤: 复制文件:
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;
}
希望这会有帮助 对于属性过滤器,您的解决方案是正确的,但类别不是属性。我已经添加了此职位字段,但它不起作用。我不能给分类过滤器定位。@user2293790,我已经更新了答案。按照以下步骤将类别过滤器置于所需位置。您需要将Mage_目录_块_图层_视图块文件复制到本地目录,这样核心代码就不会受到影响。