0

How to set sort by position Ascending order by default in the backend.

enter image description here

3 Answers 3

0

Setting default Sort Order for Store / Website / Default Config.

When you go to System / Configuration / Catalog (left menu) / Frontend you’ll see "Product Listing Sort by” drop-down menu. Now if you deselect “Use Default” you’ll select default sorting for the specified view (Store/Website/Default). This will apply to all categories but notice that by override rule (fallback) this has a lower priority than “Sort Order for category".

enter image description here

Note: If you like the answer please give thumbs up.

2
  • Still my arrow down, position 20 placed in first page.
    – zus
    Commented Mar 13, 2020 at 10:48
  • I have posted one more answer for the same where you can manage this programmatically. Commented Mar 13, 2020 at 11:38
0

There is no configuration in the backend to set sorting direction. you can use the solution in given link: How to list products in descending order?

0

The best way to go about it without changing any core files is to copy the Toolbar.php file located:

/app/code/core/Mage/Catalog/Block/Product/List/Toolbar.php

then create a new directory path (if you haven't created one) under:

/app/code/local/Mage/Catalog/Block/Product/List/Toolbar.php

Now replace the following from line 232:

if ($this->getCurrentOrder()) {
        $this->_collection->setOrder($this->getCurrentOrder(), $this->getCurrentDirection());
    }

to

if ($this->getCurrentOrder()) {
if(($this->getCurrentOrder())=='position'){ //defines the sort option
//sort by position (ascending) and entity_id (descending)
$this->_collection->addAttributeToSort('position','asc')->addAttributeToSort('entity_id','desc');
} else {
$this->_collection->setOrder($this->getCurrentOrder(),$this->getCurrentDirection());
}
}

Lastly, reindex and refresh cache on your Magento backend and your ready to go. If you need to define more then one sort option copy and paste the code below just before } else {

if(($this->getCurrentOrder())=='######'){ //defines the sort option
//sort by ###### (ascending) and ###### (descending)
$this->_collection->addAttributeToSort('######','asc')->addAttributeToSort('######','desc');

If you like the answer please give thumbs up.

2

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.