User Tools

Site Tools


Sidebar

magento_2:improved-sorting

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
  • Compatibility with Live Search for Enterprise and Cloud Editions

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.

magento 2 improved sorting disable sorting by

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

magento 2 improved sorting sorting order

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

magento 2 improved sorting sort attr descending

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

magento 2 improved sorting improved sorting other settings

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.

magento 2 improved sorting default sorting

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'

magento 2 improved sorting imp sorting6

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.

magento 2 improved sorting imp sorting24

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.

Multi-Store Bestsellers Sorting - if enabled, sorting will take into account sales from all store views of the website.

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 Status - products with specified order statuses will not be used in Bestsellers.

magento 2 improved sorting improved sorting m2 most viewed

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'.

magento 2 improved sorting imp sorting36

‘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.

magento 2 improved sorting imp sorting26

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.

magento 2 improved sorting top rated tab

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.

magento 2 improved sorting imp sorting27

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.

magento 2 improved sorting stock quantity

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.

Advanced

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

magento 2 improved sorting improved sorting advanced tab

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.

magento 2 improved sorting imp sorting10

Hit the Add New Attribute button.

magento 2 improved sorting imp sorting11

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.

magento 2 improved sorting imp sorting19

Hit the Save Attribute button.

Attribute Sets

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

magento 2 improved sorting imp sorting13

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

magento 2 improved sorting imp sorting12

To create a new set, click Add Attribute Set.

magento 2 improved sorting imp sorting20

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.

magento 2 improved sorting improved sorting bestsellers before

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:

magento 2 improved sorting improved sorting m2 attribute code

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

magento 2 improved sorting improved sorting m2 custom attribute

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.

magento 2 improved sorting improved sorting m2 custom attribute front

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.

magento 2 improved sorting imp sorting14

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.

magento 2 improved sorting imp sorting15

Hit the Add Widget button.

magento 2 improved sorting imp sorting28

Specify widget Type and Design Theme. Click Continue.

Then specify Storefront Properties.

magento 2 improved sorting imp sorting17

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.

magento 2 improved sorting imp sorting29

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.

magento 2 improved sorting imp sorting30

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.

magento 2 improved sorting imp sorting31

For the Catalog Product List type, specify the necessary conditions magento 2 improved sorting imp sorting33.

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

magento 2 improved sorting imp sorting32

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.

magento 2 improved sorting imp sorting34

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.

magento 2 improved sorting imp sorting35

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.

magento 2 improved sorting imp sorting21

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.

magento 2 improved sorting improved sorting m2 yotpo

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

magento 2 improved sorting imp sorting22

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. magento 2 improved sorting 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.

magento 2 improved sorting improved sorting last

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

magento 2 pwa installation graphql

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

magento 2 improved sorting pwa sorting mobile

magento 2 improved sorting pwa sorting tablet

Find out more about Magento PWA integration here.

Trobleshooting

Problem: The 'inventory_reservation' table remains uncleared after running the 'inventory_cleanup_reservations' cron job.

Solution:

Use the following SQL query to remove configurable products from the table:

DELETE FROM inventory_reservation
WHERE sku IN
  ( SELECT i.sku
    FROM inventory_reservation i
      INNER JOIN catalog_product_entity p on p.sku = i.sku
    WHERE p.type_id = 'configurable'
  );

Additional packages (provided in composer suggestions)

To make additional functionality available, please install the suggested packages you may need.

Available with no additional fees:

  • amasty/improved-sorting-graphql - Install amasty/rma-graphql to activate Graphql and RMA integration.
  • amasty/yotpo - Install amasty/yotpo module to activate Yotpo Reviews and Sorting integration.
  • amasty/module-mage-2.4.5-fix - Install module-mage-2.4.5-fix to fix bugs with Product Collection Changes that were added in 2.4.5.

Available as a part of an active product subscription or support subscription:

  • amasty/module-sorting-hyva-compatibility - Install module-sorting-hyva-compatibility module to activate the integration with Hyva Theme.
  • amasty/module-sorting-by-qty* - Install this package in order to use Product Salable Qty sorting. * amasty/module-improved-sorting-subscription-functionality* - This package provides the possibility of sorting Bestsellers sales across multiple stores.

For Enterprise and Cloud editions:

  • **amasty/module-sorting-live-search* - Install module-sorting-live-search module to activate LiveSearch and Improved Sorting integration.

—————————————-

Rate the user guide
 stars  from 7 votes (Details)
magento_2/improved-sorting.txt · Last modified: 2024/12/19 10:40 by skudrov