我想知道如何更改父类别页面左侧栏上列出的子类别的排序顺序(例如:"品牌"页面有左侧菜单项,按ID顺序而不是按名称字母顺序列出子类别名称)。我尝试过修改leftnav.html文件,但似乎不知道如何将名称拉入数组中进行排序。
这是我用来按字母顺序排列所有父类别和子类别的方法。。。希望它能帮助
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;
这篇文章很旧,但永远不会回答。希望它能帮助
覆盖以下文件
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;
就是这样,您将按字母顺序获得所有左侧导航项目。