According to \Magento\Catalog\Model\ResourceModel\Product\Collection you can use addAttributeToSort() method to sort your collection. This has worked for me:
Try to use Zend_DB_Select order rather then Magento setOrder method $ colection->getSelect()->order(..) Example:
In today article I would like to show you how to get all order collection with
2 Answers · 2. the setOrder() results in desc order. Is there any way to make it asc ? – Mohammad Faisal Mar 18 '14 at 9:41 · 2. ->setOrder(' ...
We take the example of product collection and filter it by give ids. You can use this on any kind of collection like order collection, category collection and any ...
product 2: price 13$;
I am try to sort my product collection. At first it should be sorted by Ascending Order (1,2,3..) and then by other character like NULL
The SortingProcessor class applies the sorting order of a search criteria to an abstract database collection. Below is an ...
Step3: Sorting the collection by "news_id" in Ascending order.
Learn to change Magento 2 sort order, collection. Find out how to sort product listing, collection by newest and other filters. Read on.