首先打开如下目录文件:
file:\app\code\core\mage\catalog\block\product\list\toolbar.php,
找到
protected $_direction = ‘asc’;
这个参数就是默认顺序
修改成:
protected $_direction = ‘desc’;
然后保存。
也可以通过以下方法来思考,magento每上传一个产品,都会给该产品赋予一个唯一id值,而id值的排序都是自加1,所以,显示方式可以根据最后上传的商品,以id倒序方式进行排序。
同样修改当前的toolbar.php
找到:
$this->_collection->setorder($this->getcurrentorder(), $this->getcurrentdirection());
改为:
$this->_collection->setorder($this->getcurrentorder(), $this->getcurrentdirection())->setorder('entity_id', 'desc');
即可。
以上就介绍了如何让magento 新上传的产品在分类显示最前面?,包括了方面的内容,希望对php教程有兴趣的朋友有所帮助。
