Monday, 26 August 2013

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

By default Magento shows products in category pages by ascending direction. For this reason, latest added product show at last in the Category page. If we want to show last added product at first in Category page we should change default product direction from ascending to descending. By changing direction you can also show your product as descending by its Name, Price and Position. I changed the default direction of my site. You can also change your product direction easily.
Change Direction from Ascending to Descending:
To change default product direction from ascending to descending-
go: app/code/core/Mage/Catalog/Block/Product/List/Toolbar.php
Now Open the Toolbar.php file and find out the following line (Line no. 119 in 1.5):
  1. protected $_direction = ‘asc’;
Now Change above code by the following code:
  1. protected $_direction = ‘desc’;
After doing this, refresh your category page. If not any change you must clear cache and Reindex by go: System -> index Management from Backend now select all checkbox.
Then Select ‘Reindex Data’ in Actions field after that click on Submit button from right top.
Now your product will show by descending direction as default in Category page.

No comments:

Post a Comment