Pages

Thursday, July 4, 2013

How to change Default Sort Order Magento



I’ll be clear… Magento is not good as you could imagine. In fact sucks in so many ways.

Today i’m showing you one. There is no backend option to change the Default Sort Order in your product listing (catalog).

Lucky there is an easy solution.
The Toolbar

Look for the file toolbar.php located in:

/app/code/core/Mage/Catalog/Block/Product/List
Create the Local folder

Create the same folder structure in the local. Now the future upgrades will not affect your changes.

Should be like:

/app/code/local/Mage/Catalog/Block/Product/List
Edit the Toolbar

Now you have to change 1 single stupid line.

Look for:
  /**
     * Default direction
     *
     * @var string
     */
    protected $_direction           = 'asc';

And change it for:
  /**
     * Default direction
     *
     * @var string
     */
    protected $_direction           = 'desc';

No comments:

Post a Comment