一般情况下,修改产品排列顺序
修改
app/code/core/Mage/Catalog/Block/Product/List/Toolbar.php
文件即可
分类页按id升序排列 protected $_direction = ‘asc’;
分类页按id降序排列 protected $_direction = ‘desc’;
1.6版本 修改了之后 没反应
对比发现,默认样本数据在分类中的排序 (position) 值为0
而手动上传的产品默认排序(position)值为1
具体是不是由于这个导致的 没有去深究…
网上查了下,选择了 一个算是比较直接的解决办法
修改 app/code/core/Mage/Catalog/Block/Product/List.php 文件
再 _getProductCollection()
方法 末尾 添加如下代码
// sort by created_at date or entity_id if(!isset($_GET['order'])) { $this->_productCollection->getSelect()->reset( Zend_Db_Select::ORDER ); $this->_productCollection->getSelect()->order('e.entity_id desc'); } return $this->_productCollection;
然后清理缓存即可
参考资料网址
(1) http://stackoverflow.com/questions/2237513/magento-sort-by-date-added
(附加)http://blog.chapagain.com.np/magento-join-filter-select-and-sort-attributes-fields-and-tables/