User Tools

Site Tools



For more details see how the Amasty Improved Sorting for Magento 2 extension works.

Guide for Improved Sorting for Magento 2

An effective tool for customer care. Improve the usability of your store catalog with user-friendly search options. The module allows your potential customers to browse catalog or categories by any parameters they need: best-sellers, most viewed, top-rated, new and in a wishlist.

  • Offer suitable sorting options
  • Enable users to view products by Best Sellers, Top Rated, Most Viewed and etc.
  • Focus on better performing products
  • Set out-of-stock products and items with no image to display at the end
  • Change sorting order if you need
  • Add featured products blocks to any page

Magento 2 Improved Sorting extension is compatible with Hyvä themes. You can find the 'amasty/module-sorting-hyva-compatibility' package for installing in composer suggest (Note: the compatibility is available as part of an active product subscription or Support Subscription).
The extension is fully compatible with Magento Elasticsearch. See how to install and configure the Elasticsearch engine here.
In Improved Sorting FAQ you can find answers to the most popular questions about the extension functionality.

Steps to configure Improved Sorting

General Settings

To configure the module, go to Stores → Configuration → Amasty Extensions → Improved Sorting.

Disable Sorting By - exclude any of the sorting options if needed.

Sorting Order - Drag and drop sorting options in the order you want them to appear in the improved sorting drop-down for the customers.

Please select the attributes to have descending sorting for them by default. Not selected attributes will have ascending sorting.

Show Products without Images Last - show or hide products without images to effectively manage your products offering.

Show ‘Out of Stock’ Products Last - choose the variant to optimize the position of the ‘Out of Stock’ products.

Starting from Magento 2.4.6, out of stock products are always displayed last on the search page, regardless of whether this setting is enabled or not.

Use qty to determine if the product is `Out of Stock`- enable this option to put products on the ‘out of stock’ list automatically. Products with the qty < 1 will be shown last regardless of the stock label.

Qty Sorting Range Step - this field requires a positive integer number. Products will be divided into ranges and sorted according to the specified quantity range step. For example, if the value is set to 10, it indicates that the product quantity will be divided into ranges of 10. Consequently, on the storefront, the product will be shown with the message: “Less than {X} in stock. So, the quantity will be rounded to the nearest multiple of 10, with an indication that less than this quantity is available in stock. If you set it to 1 in the settings, the exact quantity will be displayed. Please note that the lower the value in this setting, the more frequently the cache will be flushed.

To ensure proper sorting by Stock Quantity, please run a reindex after saving the entered range in the settings.

Show Product Range Qty on Frontend - enable this setting to display a product available quantity on product and listing pages, for example, when using sorting by “Stock Quantity”. Please note that enabling this functionality may have a significant impact on site performance.

The extension takes child product quantities into account when sorting configurable products based on their quantity.

Sorting by Default

To specify the default sorting for search and category pages, expand the Sorting by Default tab.

Set the main sorting algorithm in the First Sort by field at first, and then 2 additional ones in the Then by fields according to your needs. As additional algorithms, you can also select sorting options that are not available on the frontend. Due to the feature, you can sort products in the most efficient way and thus increase sales.

Please consider that sorting by the attribute from the first Then by field is applied for products with the same values of the main selected sorting method.

Configure Sorting Options

Using the Improved Sorting for Magento 2 extension, you can choose various additional attributes like 'Most Viewed', 'Bestsellers', etc. Note that even text attributes can be used for sorting. Please keep in mind that by using sorting by text, MySQL can process numerical entries (e.g. 20, 67, 1548, etc.) like text entries. In such cases, entry '67' will be considered as a bigger value one, compared to entry '200'

Newest - displays products in the order they were added to the website. If you would like to manage product order for this option by yourself, please, select a product attribute with the help of which you can specify the dates you need.

In cases when a product is configurable, the feature sorts by the value of the configurable product, not simple ones.

Label - specify a name of the sorting option you would like to be displayed on the frontend.

Attribute Code for the Newest Sorting - Leave empty to use product creation date. If you indicate a custom attribute, make sure `Used in Product Listing` for the attribute is set to `Yes`.

If you apply a custom attribute, the feature will sort by this custom attribute ONLY.

Bestsellers - displays best-selling products according to the statistics.

Bestsellers Period (days) - sorting option will be counted for the period, indicated here. So if you indicate ‘15’ here, sales for the last 15 days will be counted and the order of products for bestseller sorting option will be defined based on the count. Leave empty for lifetime statistics.

The field is validated by numbers. If you change the value, the index becomes invalid, that’s why reindex is required.

Custom Bestsellers Attribute - select the custom bestseller attribute to move products up in the bestsellers list manually.

Exclude Orders Statuses - products with specified order statuses will not be used in Bestsellers.

Most viewed - displays the products according to the number of views. This sorting option will be counted for the period, indicated the Most Viewed Period (days). Don’t forget to rename the sorting option to match your own vision.

Custom Most Viewed Attribute - use to artificially move some products up in the real most viewed list. Leave empty to show real data.

For the correct operation of the Most Viewed sorting Magento Reports should be enabled. Please navigate to: Stores → Configuration → General → Reports, than check that Enable Reports and Enable Product View Report settings are set to 'Yes'.

‘Biggest Saving’ - displays products with the biggest discount on the top of the list. You can use percentage or absolute values to show the difference between regular and special price. For example, you have products A & B. A costs $100; there is a 10% discount on this product, so special price $90. Product B costs $10, with a discount of 50% special price is $5. If the ‘Biggest Saving’ list is sorted by percentage, product B (50% off) would be listed above the product A. If you choose to make sorting by absolute price values, product A will go before product B on the list.

Now in Wishlists - sorting option displays products that were added by other customers to their wishlists. Put down the frontend name of the option in the ‘Label’ field and specify the data update period below.

Top rated - this option shows high rated products at the top. In the ‘Label’ field put down the name of the option that is displayed on the frontend.

'Use Yotpo Reviews instead of Magento Reviews' - Set “Yes” if you want to replace Magento reviews with Yotpo reviews.

Reviews count - the option sort products by the number of reviews. Fill in the ‘Label’ field with a frontend name.

Price: high to low or low to high - this option sorts items by price differentiation. You can also customize the title of the option.

Stock Quantity - this option sorts items by stock quantity. In fact, this is the Saleable Quantity, i.e., the available quantity of the product for purchase. You can also customize the title of the option.

The 'Sorting by Stock Quantity' functionality works on Magento version 2.4.3 and higher. It is available as a part of an active product subscription or support subscription.

How will the quantity of products be calculated for this sorting option?

  • Quantity is derived from the difference between the product qty set in the admin panel and the Out-of-Stock Threshold value. This considers both the global Magento setting and the specific setting for each simple product on their product pages.
  • For products that are out of stock, the quantity will be 0.
  • For MSI, the formula also accounts for reservations made in the admin panel, subtracting the Out-of-Stock Threshold value and the Reservation qty (which represents purchased items awaiting order processing).
  • When calculating the quantity of composite products, only simple products with a result > 0 after deducting Min qty and Reservation qty are included. Furthermore, the total quantity for composite products includes the sum of all child products.
  • Bundles are not supported for this sorting option; they will be listed with a quantity of 0 at the bottom. Other product types like simple, configurable, grouped, virtual, and downloadable products are supported.
To let customers apply all sorting options to product lists generated by layered navigation, see Improved Layered Navigation for Magento 2.


Use the Advanced tab functionality to set the initial sorting algorithm on catalog pages before frontend sorting is applied (only if it is necessary).

Global Sorting - Add attribute code to this field whether you want to sort products on catalog pages (including search results) based on this attribute first regardless of the selected sorting method. This feature will be useful if you need to group products displayed to customers before frontend sorting is applied.

You can add the code of any product attribute to this field. To utilize Amasty Improved Sorting options, please use the following values:

  • bestsellers - Best Sellers
  • rating_summary - Top Rated
  • most_viewed - Most Viewed
  • saving - Biggest Saving
  • reviews_count - Reviews Count
  • wished - Now in Wishlists
  • new - New Arrivals
Global Sorting will work for attributes even if the Used for Sorting in Product Listing setting for these attributes is set to No.

Global Sorting Direction - Please select the direction of global sorting (ascending or descending) that fits your needs more.

Custom attributes for Bestsellers and Most Viewed

With the extension, you can artificially move some products up in the real bestsellers list.

To do this, please go to Stores → Attributes → Product.

Hit the Add New Attribute button.

Default Label - specify any label you like for the custom attribute.

Catalog Input Type for Store Owner - select Price value for the setting.

Attribute code - set any code for the custom attribute.

You will also need to type this code in the configuration fields Custom Most Viewed Attribute Code or Custom Bestseller Attribute Code.

Go to Storefront Properties and set Used in Product Listing and Used for Sorting in Product Listing fields to Yes.

Hit the Save Attribute button.

Attribute Sets

To assign the created attribute to products,, please go to Stores → Attribute Sets.

Assign the created attribute to the attribute sets that you use for the creation of products in Catalog. Remember to save the changes.

To create a new set, click Add Attribute Set.

Specify the Name of the attribute set and the category to Base On. Hit the Save button.

How Does It Work?

Let's see how the feature with custom attributes works.

For example, your Best Sellers default option shows the real bestsellers first.

But you want to display a Savvy Shoulder Tote first so that it could be sold out faster. So, you create a custom bestseller attribute and assign it to Bags attribute set.

Select the attribute code of a custom attribute in the general settings:

Now find the necessary product and specify the value to improve its position.

Save the changes. Thus, the extension will display the products according to the value of this attribute. If the value is not specified, the products will be shown according to the real bestseller data.

Check the result on the frontend.

New sorting options on category page

To create and manage categories, please go to Catalog → Categories.

The new product sorting options are available on ‘Display Settings’ tab of the category page.

Display Mode - choose the mode of the block: Products Only, Static Block Only or Static Block and Products.

Available Product Listing Sort By - specify which sorting options to use.

Default Product Listing Sort By - choose the automatic algorithm to sort the products.

Manage Widgets

Let your customers know about your new, top-rated, most viewed products with the help of Featured Products Block. To manage Featured Products widget, go to Content → Widgets.

Hit the Add Widget button.

Specify widget Type and Design Theme. Click Continue.

Then specify Storefront Properties.

Widget Title - specify the title of the block you would like to be displayed on your product page.

Assign to Store Views and choose the Sort Order.

Click Add Layout Update to choose where exactly the widget will be displayed.

Display on - choose the categories, products or pages for the block to be displayed on.

Products - you can apply widget to all products or choose specific products.

Container - specify the place of the widget on the frontend.

Template - choose the type of the template. In some cases, the template is set by default.

Go to the Widget Options tab.

Widget options are variable depending on the type of the widget chosen.

1. If you choose CMS Page Link, Category Page Link or Catalog Product Link, specify the Anchor Custom Text and the Anchor Custom Title.

Select the Page, the Category or the Products for the widget accordingly.

2. If you want to add a Catalog Product List or Catalog New Product List, specify the Display Type - All products or New products.

Enable or disable Page control.

Also specify the Number of Products per Page, the Number of Products to Display and the Cache Lifetime (Seconds). 86400 by default, if not set. To refresh instantly, clear the Blocks HTML Output cache.

For the Catalog Product List type, specify the necessary conditions .

3. If the type is CMS Static Block, you have to specify the block only.

4. For the Featured Products Type, specify the Header, the way of Sorting, the Number of Products to Display, Cache Lifetime and the Conditions if needed.

5. For the Recently Compared Products or Recently Viewed Products, choose the Number of Products to display, the Product attributes to show and the Buttons to show.

Save the settings.

New sorting options on front end

The new sorting options and widgets are added to standard Magento ones on the front end and enable your customers to find the right products faster. Also Ratings and reviews of other people can be really helpful for your customers.

Compatibility with Yotpo Reviews. As well as with the Magento default reviews, you can use a 'Reviews Count' feature with popular Yotpo Reviews extension. Easily collect customer reviews and then display them on site pages to help buyers with purchase decisions. Moreover, analyzing customers' feedback data you can continually optimize your web store to provide better customer experience and increase your store conversion.

Boost your most popular products to sell even better with Featured Products Block.

This extension is available as a part of the Elastic Search Premium module. Check the configuration options here →

Cron Tasks List

Effectively control the performance of your website by managing all existing cron tasks in one place. Please, go to System → Cron Tasks List.

Here, you can see all the existing cron tasks and their statuses. Run cron tasks and generate their schedule by clicking the ‘Run Cron’ button. Also, delete tasks in bulk, apply filtering and sorting options when it is needed.

Index management

To manage indexers and see their current status, please, go to System → Index Management

To manage sorting indexer modes for sorting options like ‘Bestsellers’, ‘Most Viewed’ and ‘Wishlists’, click the ‘Actions’ button.

If the sorting is disabled by any value (see 'General Settings' - 'Disabled sorting by'), the status is ‘Reindex Required’ but reindex doesn’t perform.

‘Update by Save’ mode means that the index is refreshed automatically once per day at 3 a.m.

‘Update by Schedule’ means that the index refreshes according to your cron and reindex performs when the index becomes invalid.

Find out how to install the Improved Sorting extension for Magento 2 via Composer.

PWA for Improved Sorting (Add-On)

The extension also works smoothly on mobile devices due to a ready-made PWA solution, due to which store admin can significantly improve mobile shopping experience.

The feature can be enabled only after purchasing the PWA for Product Improved Sorting Add-On. Also, you need to install PWA Studio first.
In order to correctly install a PWA add-on, please install the corresponding GraphQL system package first. For the correct name of it, please check the composer.json file of the main module. For example, the GraphQL system package name of the PWA add-on for the Blog Pro extension would be the following: amasty/blog-graphql

If the add-on is installed, Venia theme will display category pages in the following way:

Find out more about Magento PWA integration here.

Rate the user guide
 stars  from 7 votes (Details)
magento_2/improved-sorting.txt · Last modified: 2024/02/26 16:00 by asemenova