我想将 Magento 前端导航中类别的默认顺序更改为按名称排序。运行 Magento 1.5。
有人有线索吗?
您可以通过在“管理类别”页面的左侧窗格中上下拖动它们来手动对管理中的类别进行排序。
我们也一直在寻找一种方法来做到这一点,并最终做到了:
<?php
...
$categories = array(1,3,5); // this holds the category ids you want to show, in the correct order
foreach($categories as $cat){
Mage::getModel("catazlog/category")->load($cat);
// Do whatever you want here
}
?>
这绝对不是实现您想要做的最干净的方法,而只是为您提供一个快速(肮脏?)的解决方案。
-肯尼
您需要先构建集合,然后对属性进行排序
Mage::getModel('catalog/category')->getCollection()->addFieldToFilter('parent_id', '319')->addAttributeToSort('name', 'ASC');
在管理面板中转到目录—>管理类别。从那里您可以通过在页面左侧的类别树中拖放类别来更改类别顺序。祝你好运!!!