我想知道如何更改父类别页面左侧边栏上列出的子类别的排序顺序(例如:'品牌'页面左侧菜单项按ID顺序列出子类别名称,而不是按字母顺序排列按名字)。我已经尝试过修改leftnav.phtml文件,但似乎无法弄清楚如何将名称拉入数组中进行排序。
答案 0 :(得分:1)
这是我用来按字母顺序排列所有父类和子类的内容...希望有所帮助
SET @i=0;
SET @j=0;
DROP TABLE IF EXISTS AAA_NEW_POSITION;
CREATE TABLE AAA_NEW_POSITION
SELECT
e.entity_id AS 'entity_id',
vn.value AS 'name',
e.position AS 'old_position', @i:=@i+1 AS 'new_position'
FROM
catalog_category_entity e
LEFT JOIN catalog_category_entity_varchar vn
ON e.entity_id = vn.entity_id AND
vn.attribute_id = (SELECT attribute_id FROM
eav_attribute WHERE entity_type_id = (SELECT entity_type_id FROM catalog_category_entity LIMIT 1) AND attribute_code='name')
ORDER BY vn.value ASC;
ALTER TABLE AAA_NEW_POSITION ORDER BY NAME;
UPDATE AAA_NEW_POSITION SET new_position= @j:=@j+1 ORDER BY NAME;
UPDATE catalog_category_entity e
LEFT JOIN AAA_NEW_POSITION np
ON e.entity_id = np.entity_id
SET e.position = np.new_position;
DROP TABLE IF EXISTS AAA_NEW_POSITION;
答案 1 :(得分:0)
这篇文章很老但是答案永远不会。希望它会帮助某人
覆盖以下文件
app/code/core/Mage/Catalog/Model/Layer/Filter/Abstract.php
在
app/code/local/Mage/Catalog/Model/Layer/Filter/Abstract.php
替换
return $this->_items;
与
asort($this->_items);
return $this->_items;
您可以按字母顺序获取所有左侧导航项目。