Change default sort order ASC to DESC for product listing in Magento


By default Magento shows products in category pages by ascending order. That’s why latest added product show at last in the Category. If we need to show latest added product at first in Category for this we should change default product order from ascending to descending.

By changing direction we will able to show products as descending by its Name, Price and Position.

For change order from Ascending to Descending:
For this we need to update a little bit into template. Go to app/code/core/Mage/Catalog/Block/Product/List/Toolbar.php

Now Open the Toolbar.php file into any editor of your choice and find out the following line:
protected $_direction = ‘asc’;

Now replace above code with given below:
protected $_direction = ‘desc’;

Save the file and upload the same folder and refresh your category. If it doesn’t show the reflection than you must clear cache and Reindex the Category Products from  System -> index Management.

Shashi Dhar Kumar Experience in Web/software development including client server and implementation using PHP, XML, MySQL and SQL Server. Experience of working on Apache, Linux projects, Javascript, Ajax, Putty, FTP, Remote Connection, XML parsing, Mod-Rewriting, Payment Gateways and shipping modules, Trouble shooting and Manual Testing.

No comments

Leave a Reply

Your email address will not be published. Required fields are marked *