Questions tagged [sorting]

Denotes questions related to sorting collections in Magento.

Filter by
Sorted by
Tagged with
1
vote
2answers
21 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 ...
0
votes
0answers
9 views

Magento 2 | Adminhtml | How to change sort order in customer edit

when you edit a customer in adminhtml how could I, for example, change the sort order of first name and last name. Do you have any idea? Thanks in advance!
0
votes
0answers
13 views

Cannot Sort Products by Price when using static block on category page

When defining category the user can display static block, product only or both. I am using a particular template to display the products, I am directing it by using a static block with the following ...
0
votes
0answers
12 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
0answers
23 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
vote
0answers
18 views

How to sort product by position, if every product has same position?

I read somewhere that if all product has same position it will sort by product id, but I don't think its sorting by Id. Here are a few screenshots I am sharing which I am sorting by position problem ...
0
votes
0answers
30 views

Sorting is not working in magento 2

I modified 2columns-left layout in magento 2 design.After that sorting is not working <layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:...
0
votes
0answers
19 views

How to sort products in block template by create date

In am using a block template to display products from a specific category. How can I sort the products in this block by create date (newest first)? Is there an attribute I should add? {{block class="...
0
votes
1answer
32 views

Sort product collection by date in standart category view

I'm running Magento CE 2.3.3 with Porto theme. I want to sort the products in the category overview by the date they were added without using an extra extension. By default products in category view/...
3
votes
8answers
202 views

Magento2: I want to show featured product on top of the category and search result

I have yes/no type product attribute. If this featured attribute is yes for any products, those product will show top(first featured product showing in category page then rest of the products are ...
0
votes
0answers
24 views

Products in Category Default Sort and Direction on Position Column

In catalog Category's assigned product grid, sort order is applied on entity_id as DESC by default like this: But I want to apply sort order by default on position as ASC like this: I found a file /...
0
votes
1answer
99 views

Magento 2.3 Natural Sort Order for Numeric Attributes / Sort Order Wrong

I have a custom attribute (text field) - let's call it "size". It contains numeric values like 1,2,3,10,20,30. Products are sorted by this attribute on the category page. Expected sort order: 1,2,...
1
vote
1answer
141 views

Magento 2: Multiple Product Type Not Sorting Due To Amasty Extension

I'm facing a problem due to Amasty Extension. I have a category which has 1 simple product and some configurable products, but when I try to sort them, simple product always comes first although ...
0
votes
0answers
34 views

Magento 2 : on page load product sorting not working

When I go on the category page, sorting does not work unless I select any value from dropdowns like position or price then it sorts the product. http://prntscr.com/q97trw Like in this URL https://...
1
vote
1answer
101 views

Sort the product collection before load by attribute option in Magento2

I am trying to sort the Product collection based on the attribute option value, I used below plugin Vendor/Module/di.xml <?xml version="1.0"?> <config xmlns:xsi="http://www.w3.org/2001/...
0
votes
0answers
25 views

Sort attributes in layered navigation. M2

I'm trying to sort options of attributes in alphabetic order. For example we have attribute "color" and there is options: 1) attr 2) bttr 3) attr2 I need to sort this options like: 1) attr 2) ...
0
votes
0answers
23 views

Magento 2.3.1 Sorting on front end category page not working

I've added a custom attribute 'screen_size' and given it set values as drop-down list, but when I've added it as a sort-able field it's not actually picking up the value of the attribute but rather ...
2
votes
2answers
82 views

Sorting on a date's component

For Magento 1.x How do I sort product based on a date attribute by a month and year only, rather than on the whole date? The code looks a bit like this: Mage::getSingleton('...')->...
0
votes
0answers
42 views

Sorting products based on a custom attribute Magento2

I have a plugin that adds some custom product sorting, based on a customer attribute, in a way similar to below. # Vendor\ModuleName\Plugin\Product\ProductList\Toolbar; case 'capacity_low_to_high': ...
1
vote
1answer
115 views

How to change products sort order in magento 2?

In product list page I need to change the sorting order. I have a current order like: Description A-Z Price High To Low Price Low to High Description Z-A I need to change it to. Description A-Z ...
0
votes
1answer
44 views

Magento 2: sort values in collection with unique flag

I have an array as collection and ordered it in ascending order with respect to expiry date as below: $creditDetails = $this->_creditFactory->create()->addFieldToFilter('customer_id', 1)->...
0
votes
1answer
25 views

Magento 2: Display out of stock items in the end in API

I am using a headless magento 2 approach for my store. I have made an API which accepts parameters like: category_slug, sort_by, sort_order, page_size, current_page and returns the products ...
0
votes
0answers
234 views

Magento 2 Sort product in cms page widget block

I want to insert multiple products in a cms page using SKU . So i did using blocks . So please see my code {{widget type="Magento\CatalogWidget\Block\Product\ProductsList" show_pager="0" ...
0
votes
0answers
11 views

Changing order of color attributes for admins

Trying to change the order of our list of colors (attributes > product > color) for easier admin management. I've seen a few SQL solutions, but wondered if anyone had used JS, or something similar to ...
1
vote
1answer
119 views

Magento 2 How to sort admin column in desc order?

I have a custom grid, I am trying to sort it in desc order What I did Try 1:- In my Grid Collection: protected function _renderFiltersBefore() { $orderUpdate = $this->getTable('xyztable');...
1
vote
0answers
36 views

Sorting is not working on category page

We have dropdown, which have an option to sort the products by position, name, etc., but its not working. Could anyone please help me?
0
votes
0answers
25 views

Magento 2 - How do i sort custom attribute in admin product listing gridpro

How could i sort product attribute in admin product listing? I couldn't find how they call the attribute in product_listing.xml . Drag and drop is not what i'm looking for. I want something ...
0
votes
1answer
246 views

Magento 2 - Custom sort order not working properly

I have created a custom plugin for sorting options for high to low & low to high price. High to low sort works fine but "low to high" sort order not showing correct results. app/code/Digital/...
0
votes
0answers
18 views

Sort Customizable Options values in backend

I want to sort option values alphabetically. I already did in frontend now i want same in backend - see image, please I know this can be done manually but I have a large number of products and ...
0
votes
1answer
327 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
22 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
450 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
79 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
42 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
28 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
41 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
36 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 added block in catalogsearch_result_index.xml but not loading.
0
votes
0answers
259 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
95 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
26 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
121 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
21 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 ...
3
votes
2answers
378 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
40 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
142 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 ...
2
votes
1answer
394 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
33 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
42 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
327 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
20 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
2 3 4 5
7