Questions tagged [sorting]

Denotes questions related to sorting collections in Magento.

Filter by
Sorted by
Tagged with
0 votes
0 answers
44 views

Sort by price (with prices per customer groups applied) logic in Magento 2.4.5

Where I can find sort by price logic? I checked elastic search and the price is stored in the format: e.g. "price_1_1:10, price_2_1:15" Where the first number after price" is ...
  • 15
0 votes
1 answer
43 views

Plugin SortOrder

I was reading plugin documentation and I was wondering, if there is a plugin with SortOrder=0 how can i excute another plugin before that one, would SortOrder=-1 work? Is that a bad practice? Is there ...
  • 25
0 votes
1 answer
87 views

Why Out of Stock Products showing at end of list in Magento 2.4.5?

We have created a category page and assigned some products to that category page. We have also assigned some out-of-stock products. But when we sort products by price the out-of-stock products show at ...
0 votes
1 answer
17 views

Field order in onestepcheckout of Claue Template

I use onestepcheckout from claue theme and PostNL address check. As you can see postcode, huisnu and toevoeging are at the bottum of bezorg adres iso after achternaam. How can i move these fields up?
  • 21
0 votes
0 answers
57 views

Can not re-order "Customizable Options" on "Simple Products"

I recently upgraded from Magento 2.3.x to 2.4.5. Bit of a hassle but got basically everything working. One issue I am having is with the "Customizable Options" section when creating or ...
  • 1
2 votes
0 answers
23 views

Sorting images issue ( Magento 2.4.3

I face an issue when upload images bulky that i don`t have the way to sort it as i want , it is sorted random , even if i one of it as base,small,thumbnail Need the way to know how to sort it for ...
  • 21
1 vote
0 answers
101 views

Magento 2.4.4 upgrade after custom sorting filter Ascending/Discending order not working with porto theme?

I have upgrade Magento version 2.3.7 to Magento 2.4.4, before upgrade custom sorting option is working fine.after upgrade popularity asc/desc sorting is not working. we are currently using smartwave ...
0 votes
0 answers
111 views

Magento2.4.4 Sort by Created at date not working with elastic search

Magento2.4.4 Sort by Created at date not working with elastic search $this->_collection->getSelect()->order('e.created_at DESC'); Please advice. Mysql working fine.
  • 3,476
1 vote
1 answer
19 views

How to change (text) after sorting option on category page

I need help changing the text in () when selecting the sort option. With translation I change to Low to high and High to low but I have to change Product name to (A-Z). I don't know how to change only ...
0 votes
2 answers
224 views

How to sort menu items in the top menu in alphabetical order in magento2 frontend

Is there any way to sort menu items(Categories) showing in Magento in alphabetical order?
  • 23
0 votes
0 answers
88 views

Magento2 : Save Product Quantity To Custom Attribute

I Want To save Product Quantity Value In Custom Attribute. For That, I Have Created Patch With backend_model :-Magento\Catalog\Model\Product\Attribute\Backend\Stock. Whenever I save Value It Renders [...
0 votes
0 answers
49 views

Magento2 : Category Page (Product Listing Page) Custom Sorting Option Not Working

I Want TO Display Product Based On Product Stock On Category Page. I Have Used Code As Below. I Have Used the Around Plugin To Set Collection. File:- di.xml Vendor\Module\etc\di.xml <type name=&...
0 votes
0 answers
94 views

How can I modify logic for Sort by Lowest Price?

In my Magento store in the category page I display a grid of products each product contains used and new products. All configurable products are considered new, all used simples are considered used. ...
  • 41
0 votes
0 answers
40 views

Magento2 on listing page after ASC sorting move attribute with values null or 0 at last

Magento2 How to move null & 0 value custom attribute values at last after ASC sorting on list page
  • 3,476
0 votes
0 answers
154 views

Magento 2 : Render Product Using Custom Sorting Option

I want to display product on Qty Desc order but shows no product to display. I run sql query used in sorting and it working in as per qty. I have tried below code. $collection->setOrder('price','...
0 votes
1 answer
279 views

Magento 2 PWA store add new sorting in product listing page

How to add new sorting in product listing page. I have frontend is PWA. So can you explain me how do that. THANKS.
  • 3,550
0 votes
2 answers
730 views

Some Filters not showing on some Categories in Magento 2.4

Some Filters not showing on some Categories in Magento 2.4 As you can see in two images both are diffrent categories but Newest filter not showing in second image. In some categories it just show ...
  • 586
0 votes
2 answers
1k views

Custom Sorting option not working in Magetno 2.4 search

Custom Sorting option not working in Magetno 2.4 search app/code/Arun/NewSorting/etc/di.xml <?xml version="1.0"?> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance&...
  • 586
0 votes
0 answers
112 views

How to sort by name all categories in my layered navigation?

I need to have all categories and subcategories ordered by name. How can I do it? Do I have to modify this file? app/design/VENDOR/THEME/Magento_Catalog/templates/navigation/left.phtml I've tried: $...
0 votes
0 answers
46 views

How to add Custom Sorting option with created date on category page in Magento 2

I want to add Custom Sorting option with created date on category page in Magento 2. Like its label would be Newest Product and the product sort is based on product crated date. SS attached for more ...
  • 586
0 votes
0 answers
28 views

Product sort in catalog page not correct

I'm using Magento 2.3.4. On my product list page, when I sort price ASC or DESC, the price is not correct. Here is a picture of the result: In the URL, I can see param in URL https://example.com/wine....
  • 121
0 votes
1 answer
321 views

How to add sort by filters to the custom collections magento2

I would like to display Sort By filter options to the order collection Magento2 at the front-end and display the results. Sort by options are 'processing','cancelled', 'hold' etc. Can anyone advise ...
0 votes
1 answer
355 views

Sorting custom column in ui component

I've created a custom column in the report using UI components that use DataProvider in report_listing.xml Unfortunately, this new custom column is not able to sort. I made also a class for this ...
  • 1
0 votes
2 answers
575 views

Sort order products in categories by custom value attribute first in Magento 2

I want to sort products with custom value (1) numeric attribute. In toolbar.php: if ($this->getCurrentOrder()) { $this->_collection->addAttributeToSort( $this->getCurrentOrder()...
0 votes
1 answer
413 views

How to create custom sorting in sales grid custom column in Magento 2?

I have created a custom column named printed which shows the invoice is printed or not and works well. But how to apply sorting in in it like when i click on printed firstly it shows all data with ...
  • 586
0 votes
3 answers
178 views

How to sort modules in config.php alphabetically?

Is it possible to sort the output of the modules node in config.php alphabetically? This way git versioning won't get messed up since Magento sometimes changes the sorting. <?php return [ '...
  • 1,392
0 votes
1 answer
751 views

Magento 2 | Change sort order for search results

I would like to set as the default order in the search results page "relevance" in descending order. How can i do? Thanks
  • 417
0 votes
0 answers
406 views

Magento 2.3.2 sort the product collection by attributes

I want to sort the product collection by attributes. I want to apply multiple sorting to the product collection need to sort by NEW, ONSALE, and POSITION For example when going to any listing page ...
  • 6,016
0 votes
1 answer
133 views

Can we update Product Position in Category with CSV in M2?

Can we update products position with csv in Category ? If yes than please share share any sample or example. Thanks
0 votes
0 answers
28 views

Best way to do this?

I've been racking my brains for a long time trying to think of the best most efficient way to solve the following problem. Basically I have a set of questions which I'm looping through in the ...
  • 176
2 votes
1 answer
271 views

Custom Sorting on category page not working in Magento 2.4.2

I have Magento 2.4.2. I have written a custom code to add A-Z & Z-A filters on category page. I have added dependency injection using below code <preference for="Magento\Catalog\Block\...
  • 1,494
2 votes
0 answers
186 views

Magento 2.4.2 and elasticsearch issue (sort by position)

As I have seen, sort by "position" does not work with Elasticsearch (I have no result when I want to see the products in a category). I would like to disable position sorting on ALL ...
0 votes
1 answer
247 views

Paginate order list by 15 items and sort by price ASC

I need to do sort by price and paginate by 15 items for order list history page, can anyone help?
0 votes
2 answers
776 views

Sort products by In stock in magento 2.4

Can we sort products In stock only. see the below screenshot.
  • 475
0 votes
1 answer
476 views

Magento 2.4 : Sort Product by attribute value

i have configurable and simple product in my website with Attribute color: (Values - Red, Green, Blue) I want to sort product on the listing page with specific attribute value, for example, all ...
1 vote
1 answer
462 views

How can you map a virtual column in magento 2.4.1?

I have just upgraded to Magento 2.4.1 that REQUIRES you to use Elasticsearch as the search engine instead of MySql. In the previous setup (Magento 2.3.2) I had a custom sort by a discount in the ...
4 votes
2 answers
2k views

Elastic Search: Custom sorting options not working after enable elastic search

I'm trying to add custom sorting options like newest products,price high-to-low & price low-to-high in category page using plugin. After creating plugin it's working good in category page and ...
  • 821
0 votes
1 answer
206 views

Column 'created_at' not imported

My goal is to sort products on the frontend from newest to oldest. The products CSV file contains the created_at column (e.g. 2020-10-31 14:05:44). Format seems to be correct. After the standard ...
0 votes
1 answer
52 views

Magento2 query displaying perfect result in database but wrong in collection while sorting by created_at

Magento2 query displaying perfect result in database but wrong in collection while sorting by created_at Query SELECT `e`.*, `cat_index`.`position` AS `cat_index_position`, `price_index`.`price`, `...
  • 3,476
0 votes
1 answer
167 views

Category Products - Sort By Newest

Since upgrading to Magento 2.4x and having to use ElasticSearch as default, I am unable to find a way to sort category products by newest (created_at). I have tried enabling used_in_sort_by for ...
0 votes
0 answers
122 views

Magento2.4 sort by created date not working

Magento2.4 Sort by created date not working on list page case 'new_arrivals': $this->_collection->getSelect()->order('e.created_at '. $this->getCurrentDirection()); break; It just ...
  • 3,476
-1 votes
3 answers
749 views

Magento 2 - Sort by Brand and Position?

Is it possible to sort by A the Brand alphabetically and then B by Position Programmatically.
1 vote
0 answers
44 views

Sorting Products at Category Page

Is there a way to bulk update products position at Category Page importing a CSV file via System -> Data Transfer -> Import ? Cordially, Daniel Mas
2 votes
1 answer
3k views

Magento 2 GrahQL Product Sorting does not work for the product query with category Filter

I have this graphQL query { products(filter: {category_id:{eq: "5"}, price: {from: "0", to: "999999"}}, pageSize: 10, currentPage: 1 sort: {position: DESC}) { ...
  • 1,946
1 vote
1 answer
825 views

Custom column sorting(DESC and ASC) not working in custom grid Magento 2.3.5

Actually in below listing.xml file i am trying to sort customer_id column DESC/ASC but not working fine. After using below code it's loading the data in ASC order only if sort customer_id column one ...
0 votes
1 answer
80 views

Show products with zero quantity last in Magento 1.9

I want to show products with zero quantity last in all site categories, search results, etc. But the sort order should be as follows: the products with a non-zero quantity (not in decreasing, default (...
0 votes
1 answer
490 views

Change order of widget catalog products list

I have a product in my product list, which must be at the top. After I have extended the product list, the product is unfortunately no longer at the top. I add the product list via the widget catalog ...
1 vote
2 answers
487 views

Magento 1.9 How to sort product in category page by stocks product

I want the products to be displayed on the category page, if available That is, first those that are stocks , then those that are not stocks I didn't find anything with the title in the attribute Is ...
1 vote
0 answers
382 views

Sort Menu items in aphabetical order magento 2 in observer

I am creating menu items in magento 2. I is working fine and generated according to category order in admin dashboard. But I wanted to sort the menu items alphabetically on store front ir-respective ...
1 vote
0 answers
104 views

Magento 2.3 sortOrders not working in search rest API

I tried to pass sort order in V1/search API as below but the sorting is not working in the result. searchCriteria[sortOrders][0][field]=price searchCriteria[sortOrders][0][direction]=DESC Anyone has ...

1
2 3 4 5
8