Questions tagged [sorting]

Denotes questions related to sorting collections in Magento.

Filter by
Sorted by
Tagged with
24
votes
7answers
48k views

Magento 2 How to add custom sort by option

I need to add an additional filter based on created_at attribute for sorting product list by latest product. I tried to figure it using below file app/design/frontend/Vendor/ThemeName/Magento_Catalog/...
24
votes
3answers
22k views

Magento 1.9.1 configurable product attribute sorting

As i already mentioned, there seems to be a problem with magento 1.9.1 and the sorting of attributes of configurable products. The options of a configurable product now ALWAYS depend on the product ID ...
4
votes
1answer
2k views

Custom sorting for product collection

I have to implement the following scenario. The default sort order in category (by position) should ignore the position set for the products in the category. Instead when sorting by position it should ...
0
votes
1answer
408 views

exclude previously displayed products on product page

exclude previously displayed products while sorting random and navigating to next page i m using if($this->getCurrentOrder() != 'price'){ if($this->getCurrentOrder() != 'created_at') {...
1
vote
1answer
4k views

How to get recently added sort by option?

I need to have recently added sort by option how can I get this.I searched google and also SE's but cannot found the solutions but not worked.
3
votes
2answers
2k views

Product List Page Sort by Most View ( can we sort this by page views/hits)

I Want To Sort By Product Listing Page using Most View. Most View means highest Product visited Display First. means highest show product to Lowest Product. What Can Change i Don't Understand. Can You ...
18
votes
5answers
37k views

How to list products in descending order?

This seemed simple but is proving otherwise -- I just want to list all products in my store from high -> low To do so, I went to: Configuration -> Catalog -> Product Listing Sort by -> (I ...
13
votes
5answers
61k views

Magento - Unable to set order of collection

This doesn't seem to be ordered correctly, anything I'm doing wrong? Suggestions? $componentQuantityCollection = Mage::getModel('catalog/product')->getCollection(); $componentQuantityCollection-&...
10
votes
1answer
10k views

sort products by newest, discount, most sold, reviews" in products list page

On the products list page, we can see sort by "Position, name, price" as in default Magento. How to sort by newest products (uploaded recently) Discount (highest discount products first) Best ...
12
votes
1answer
19k views

How to specify custom sort order for product collection?

I am trying to create a product collection based on array of products ids, and also sort the collection based on the ids array. $productIds = array(318,310,311); $collection = Mage::getModel('catalog/...
5
votes
3answers
4k views

Product List Page Sort by Most View in magento 2.1

We need to bring most viewed, most subscribed and latest options in the sort menu in product listing page of our magento 2.1 application (magento 2.1.7). I already refered the this link Product List ...
3
votes
3answers
2k 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 .....
2
votes
2answers
14k views

Need to change my sort order for search results

i have made a new attribute called Best sellers (attribute code: search_order) so I can sort my products showing the best sellers at the top when someone searches for products. However when someone ...
3
votes
1answer
282 views

Natural sort for sortby Name

I want to sort catalog products by name in natural order. In order to achieve it i created a custom module and overwrote Mage_Catalog_Block_Product_List_Toolbar. public function setCollection($...
3
votes
8answers
931 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 ...
3
votes
1answer
831 views

Sort products by color in the cart in Magento2

I have configurable products with virtual variations by color and size. In the cart, I am trying to arrange them in the order of priority, by configurable parent, then by color, then by size. In my ...
2
votes
2answers
1k views

Automated category sort by sale

I would like to make automated category, where I want to have all catalog products sort by discount price percentage from the highest discount to the lowest. Could anyone help me? I tried many ...
3
votes
1answer
2k views

Cannot sorting joined column in Magento Grid

I have joined 2 columns to customer grid, I can make them filterable but I don't know how to make them sortable. Here is my _prepareCollection function: protected function _prepareCollection() { ...
4
votes
3answers
8k views

How to add custom sort by option filter in tool bar in magento2

I want to custom sort by option filter attribute add in tool bar section. Currently Magento 2 provide Position , Product Name , Price And Sorting option to low to high. But i need to change all ...
5
votes
1answer
519 views

How to control search result ordering

Lets say someone searches for "item a" , and 20 items show up, is there a way to control which item shows up first and which item shows up second and so on?
4
votes
3answers
1k views

“random” order clause added to my collection

For a module I load a custom product collection where I select products based on IDs in an array, I also try and sort the collection by the same order as the IDs have in the array(). To achieve the ...
3
votes
2answers
1k 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 ...
1
vote
1answer
263 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
2answers
2k views

Sort Product Collection by custom integer attribute

I created a custom_stock_status attribute in my module with 'int' backend type and four options in resource. array( 4 => 'In Stock', 3 => 'Soon', 2 => 'Out Of Stock', 1 => 'Discontinued', ...
3
votes
1answer
4k views

Sorting and filtering not working with custom column in Customer Grid Magento

I have add a custom column in customer grid by copying core Grid.php file to local folder. I want to show last order date of customer in a column. So I have tried below code in collection. protected ...
3
votes
1answer
2k views

Sort Products by Date in Admin

Often we need to sort products in the admin on creation date. I know I can sort on ID, and this way I'll get the products in the this order, and I found some (free) extensions that give me the option ...
2
votes
2answers
12k views

Adding more options to 'sort by ' in product listings

I want to add more options in the 'sort by' box. How can I add these and what are other options to add there? In this image there are 2 options, Name and Price. How can I add more options?
1
vote
3answers
3k views

Magento2 sort products and search result by stock availability

I need to add an option in the Sort By dropdown which sorts the products with based on stock availability of the products. So far i have created a plugin for setCollection methodMagento\Catalog\Block\...
1
vote
2answers
2k views

“A joint field with this alias (bestsellers) is already declared” product sorting Magento

I am facing this issue on product sorting in product list page. I have few new options in sorting like 'Best Sellers','Best Viewed'. When i used this options for sorting , it is giving me an error "A ...
1
vote
1answer
1k views

Magento 1.8 Product Sorting by Price not uniform for Single and Configurable products?

Take a look at http://goo.gl/N2ZzzZ If I do a sort by price, ASC or DESC, the product sorting is all over the place (just compare the $ values). Probably because some of the products are single ...
1
vote
0answers
33 views

Disable Category Page Description Content from showing on Sorted Results

Our category pages the description attribute shows at the top of the page. This section is really helpful for the initial category experience. Problem: When the user sorting in the category, the ...
1
vote
1answer
104 views

Products list sorting order

I have a list of products with 3 attributes (Date, among others) to sort by. By default the sorting is an ascending order, is there a way to change it to be a descending order instead?
0
votes
1answer
392 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/...
0
votes
1answer
160 views

Which Attribute Type for layered nav and filterable numeric value

I would like to put an Attribute called "Volume" to my Magento Online Shop. Products should be sorted by this attribute and it should be filterable through the layered navigation. since text ...
0
votes
2answers
920 views

Sort products in frontend catalog view based on which attribute set they belong to

Using Magento CE 1.9.0.1. We're trying to find a way to sort products on our site based on which attribute set they were created with. We sells clothes on our site so we have a number of attribute ...
0
votes
1answer
407 views

How to sort grouped products without modifying core files

The last answer here is exactly what I'm looking for, but I want to do it the clean way: How to sort associated products in a grouped product Has anybody a solution to achieve this within the grouped....
0
votes
0answers
181 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.