Questions tagged [sorting]

Denotes questions related to sorting collections in Magento.

Filter by
Sorted by
Tagged with
0
votes
1answer
36 views

Use join table to display data in admin grid column

How can I use join table to display second table data in admin grid? Admin grid is created using layout & block in proper manner. I used this link (how to create a grid without using ui component ...
1
vote
0answers
13 views

How to remove default options from sort order list?

How can I remove default options from de sort by list? For example, see the image? Is it possible to remove Best Sellers from the list?
0
votes
0answers
37 views

magento 2.3.1 - How to sort product name, price in ascending order in search result page?

Below is my search result page sort by product name in result page. Products are sorting by name by Z to A. I want to show the products in A-Z order when user click Product Name sort By option.How ...
0
votes
0answers
16 views

How sort by option working in category page and search result page in magento 2?

In My category page sort by option if i click Product Name products are sorting A-Z, In Search Page if i click Product Name products are sorting Z-A. Is there any setting to do to sort the products A-...
0
votes
0answers
19 views

Magento 2 - double ordering in category page

Some products have custom attribute blue_widget. On category pages, I want to list all blue_widget poducts that belong to that category first, and then the rest of the products. However, I want to ...
0
votes
0answers
17 views

Grouped product sorting issue when tier price in associated product

I have grouped product listing but it showing wrong sorting based on price. Associated product has tier price so based on it showing wrong on listing. Screenshot
1
vote
0answers
29 views

The image is not assigning to the correct attribute option after sorting when use visual swatch- Magento 2.3.1

Summary of Issue: I am looking to sort the color attribute options programmatically with input type 'Visual Swatch'. I have made customization in below files to sort the attribute options: File 1:...
0
votes
0answers
12 views

Magento2.1.9 - Catalogsearch pagination not work

When I'm searching by product name via mini search / advance search but the issue is toolbar.phtml not loading. I was added block in catalogsearch_result_index.xml but not loading.
0
votes
0answers
24 views

Magento 2 REST API: Sort using custom attribute

I have created a custom product attribute best_seller and I want to use it for sorting API response. I am using the following API: V1/products?searchCriteria[filter_groups][0][filters][0][field]=...
0
votes
0answers
36 views

Magento2.3.0 How to brand filter sorting left side layer navigation

I am using Magento2.3.0 i need to brand filter sorting for left side layer navigation. I attached image for layered navigation to clearly understand, where am i need.
0
votes
0answers
18 views

Magento2.3.0 How to attribute for brand layered navigation automatically A-Z

I need in programatically set brand attribute layered navigation automatically A-Z. If anyone know please reply for specific category attribute option sort by ascending order. Thanks in advance.
0
votes
1answer
25 views

Sort product collection on stock status in magento2.3

I want to sort my list.phtml and catalogsearch by availability. Mean that when category page or search result page loads, first show "in stock" product and at the end show out of stock items. Don't ...
2
votes
0answers
19 views

Magento2.2.7 PLP sorting breaks after we place orders

Whenever we place an order on store front and come back to any category page, the sorting is not working(sorting breaks) . To fix this we needed to run a reindex on the below indexers and clear the ...
0
votes
0answers
15 views

Sorting on parent categories

Let's say that we have the following categories: Category A (60 products) Subcategory A1 (20 products) Subcategroy A2 (40 products) Products are assigned only to Subcategories A1 and A2, but they ...
3
votes
2answers
125 views

Sorting by product ID

I'd like to add product id as a new sorting option in frontend catalog pages. How can I do that? This attribute is not listed in product attributes configuration in magento backend. I guess that it ...
0
votes
0answers
20 views

magento2 Sort is not working on PLP due to entity_id

We are working on Magento 2.2.7. On PLP, sort by price is not working. This is because in the query it first sorts the items by entity_id then only using the price field. Example query is given below ...
1
vote
1answer
54 views

Magento 2: How can change in the frontend sortOrder of Grand Totals and Tax positions in my account order detail page?

I need to change sort order in order_totals block in the frontend order view page. I want to swap the position of Grand Total & Tax in order_totals child items. Please help to change to order of ...
1
vote
1answer
31 views

How to sort by position field

This is my collection function: public function getCollection() { $searchCriteria = $this->searchCriteriaBuilder->addFilter('status', '1')->create(); $someCollection = $this->...
0
votes
0answers
13 views

Incorrect product sorting for numerical attributes (Magento 2.2.8)

I've got a shop with an attribute "capacity" created via Magento Backend: Shops -> Attribute -> Product It has "Text Field" as input type and "Decimal" as validation. So for new products therefore ...
0
votes
0answers
24 views

Magento 2 sorting duplicates

i have a problem with sorting products on magento2. When i sort by price or position some of the products gets duplicated. And it shows less products. For example if i have 20 products(10 per page) it ...
1
vote
1answer
77 views

Need help with ui component and change sorting order of columns in magento 2

Have listing but need to change view of one column: <column name="status"> <settings> <filter>text</filter> <label translate="true">...
1
vote
0answers
19 views

M2 - Previous & Next product from category

I have this code below to show the Previous & Next buttons on the product detail page, but the next en previous product are based on the position in the category. How can this be modified so the ...
1
vote
1answer
49 views

Magento 2 - Category page `addAttributeToSort` not working on custom product attribute

I used the following code for sorting on category page. if($this->getCurrentOrder() =="latest_products") { $collection->addAttributeToSort('significance', 'DESC')->getSelect()->...
9
votes
1answer
5k views

Magento 2 - Product sorting issue on category page using product attribute

I made product attribute and assign it on of attribute set so that it will show in the admin product detail page. Based on this product attribute I sort the product collection on category page. The ...
1
vote
1answer
67 views

Sort products in ascending order by name on specific category page not working

I want to sort product for a specific category by name in ascending order but it is still sorting in descending order in the front-end. For a category under Display Setting, I have set Default ...
1
vote
1answer
86 views

Magento 2 - Category page sorting does not work on grouped products

I added the new product sorting attribute related to price in category page like price low to high and price high to low. It showed on Sort By drop down. It is working fine for configurable product ...
1
vote
4answers
50 views

Categories are not in order same as in Admin panel Magento 2

I am listing children categories of specific category using below code: $categoryFactory = $this->_categoryFactory->create(); $category = $categoryFactory->loadByAttribute('url_key', 'shop');...
0
votes
0answers
142 views

Magento2 Catalog search result and product listing grid only sort by product name set

I need below condition to my website. Magento2 Catalog search result and product listing grid only sort by product name to be set. I have also back-end configuration done but issue is like product ...
0
votes
1answer
57 views

Grouped product (simple product sorting on price) Magento 2

In Magento 2.2 on the product view page is it possible to sort the simple products of a grouped product based on price (or any other attribute)? At the moment they seem to be sorting randomly. I ...
0
votes
0answers
11 views

Checked “Use Config Settings” for “Default Product Listing Sort By” for all categories

How to checked the checkbox "Use Config Settings" for "Default Product Listing Sort By" using script or sql ?
1
vote
0answers
28 views

Sort by Each Price Magento 2 via \Zend_DB_expr

I've had this working previously however seems to be causing me some difficulty now, basically i have a unit of sale attribute that I am using to get an each price from the sale price: if ($...
2
votes
0answers
26 views

Position not showing in category sorting dropdown

I have a problem with the sort order of products in the categories: The Position option is not showing in the dropdown as you can see in the screenshot. In the Magento backend the position is ...
3
votes
1answer
111 views

Product collection sorting broken in Magento 2.3?

I am trying to sort by price on a product collection query, however, it seems sorting by price is reducing the result set to 0... Here is a working query which returns expected number of products (...
1
vote
0answers
22 views

Magento 1.9.2. - (Configurable) Sort collection of associated products by attribute value position

I tried with multiple codes to try and sort the collection of associated products based on the position of the attribute value but without success. With my foreach in the product page I have pulled ...
3
votes
3answers
610 views

Sort by price is not working as expected in magento 2.2.7 product listing page

when I sort by price product order in Asc or dec. In product listing shows like, First product price is 40, second product price is 50 and the third product price is 40. If I opened and save those 50 ...
2
votes
1answer
82 views

Sort collection by discount

I want to sort my collection by discount percentage for my sale category, I don't know if it is possible in Magento
0
votes
1answer
40 views

Magento 1.9 sort collection by one of the fields value

Whetever I do it still gives me the same results. Querying cms_block ids: $collection = Mage::getModel( 'cms/block' ) ->getCollection() // can't add addAttributeToSelect(whatever ...
0
votes
0answers
57 views

how to sort products on custom attribute and then on sku in magento 2 category page

how to sort products on custom attribute (i.e. brands) first and then on sku in magento 2 category page For example if 10 products have same brand then it should sort that 10 products on SKU
0
votes
2answers
57 views

How can I remove %26 and %3D from url?

When I want to sort products by price (low to high and high to low), my link is not working. Option value is "price&product_list_dir=asc", which encode in "price%26product_list_dir%3Dasc". How ...
0
votes
0answers
55 views

Magento 1.9.2. - Set Order by position attribute value of associated products

I'm trying to order my foreach for the products associated with the configurable product. I would like the values ​​to be printed in ascending order by position relative to the size attribute. At the ...
0
votes
1answer
142 views

Magento 2 Product Form Categories Sort Alphabetically From the Backend

I want to sort Categories alphabetically of the product form, how can I? For more clarification please look onto the below picture. As I checked, by default Magento 2 sort according to the category ...
0
votes
1answer
24 views

Not able to sort the column items in grid

I have created a custom grid I am not able to sort the items of a column.(ascending and descending).If i click first time it will sort in ascending order.Second time it will descend the contents.But ...
0
votes
1answer
95 views

Magento2 : How to override any product custom option price sorting in list page

I have one simple product it's price zero(0). it has a custom option with name and price like: ------------------------- Name Price ------------------------- product A 10 ...
3
votes
3answers
475 views

Sorting and sort direction applied together

Is it possible to apply sorting option and direction at the same time, using sorting select box? The sorting select box could have options like: Price Asc Price Desc Position Asc Position Desc .....
1
vote
0answers
68 views

How can I sort a category product loop by position with elastic search outside of category page?

I am creating a product loop on the homepage of our site. The site has smile elastic search running. I have set up the manual sort for products in the category admin and can loop thru the products, ...
0
votes
0answers
15 views

Custom sort by functionality in custom module

I need custom "sort by functionality" for customer. I have a list of customer showing in forntend account dashboard , in that i need to implement "sort by functionality" (like sort by or sort by email ...
1
vote
0answers
504 views

magento 2 : Product listing default sorting order based on attributes

i have add sort by attributes to products say like below one. "Publish date" "Product Name" "Price" Now i want to change sort order based on default attributes. For eg 1: Publish date -> Descending ...
0
votes
1answer
146 views

Sort product collection by Latitude and Longitude

I need to sort product collection by latitude and longitude in product listing and search page. Explanation: I have two product attributes Latitude and Longitude. All product has single Latitude and ...
0
votes
1answer
608 views

Magento 2.2 listing page products sort by price is incorrect

I'm using Magento CE 2.2.6 In front-end when we sort the category pages by price, the sorting happens wrongly. Any suggestions are appreciated.
0
votes
0answers
98 views

Default sort order for default sort attributes

So it is already possible to select custom attributes for the default sort order in categories. But this sorts by default ascending. If we have - like in our case - a popularity rating which is a ...