Search by

hryvinskyi / magento2-catalog-sorting-top-rated

hryvinskyi

Catalog sort option Top Rated: the products with the highest customer rating first, taken from the review summaries by the daily popularity data refresh.

Package info

github.com/hryvinskyi/magento2-catalog-sorting-top-rated

Type:magento2-module

pkg:composer/hryvinskyi/magento2-catalog-sorting-top-rated

Statistics

Installs: 0

Dependents: 1

Suggesters: 0

Stars: 0

Open Issues: 0

1.0.0 2026-11-18 19:58 UTC

This package is auto-updated.

Last update: 2026-11-18 20:10:33 UTC


README

Adds Top Rated to the storefront Sort By list: the products with the highest customer rating first, per store view.

What it does for a store

  • A Top Rated sort order (product_list_order=rating_summary), offered in the store views where it is enabled. A listing sorted by it opens highest-rated first when the shopper chose no direction.
  • The platform's rating summary, per store. A product's value in a store is the rating_summary its review summary row holds for that store. The module computes no rating of its own.
  • Copied once a day, not per request. The value is read with one select over the review summaries by the popularity data refresh of hryvinskyi/magento2-catalog-sorting-metrics. Only products whose value changed get their search documents rebuilt.
  • Sorted in the search engine on the numeric document field sort_rating_summary; no join and no computation per query. A product without a rating sorts as 0.

Requirements

  • PHP 8.1 to 8.5.
  • hryvinskyi/magento2-catalog-sorting, hryvinskyi/magento2-catalog-sorting-options and hryvinskyi/magento2-catalog-sorting-metrics, ^1.0 each.
  • The platform's Review, Catalog, Store, Config and Backend modules (what composer.json and etc/module.xml declare).

Installation

composer require hryvinskyi/magento2-catalog-sorting-top-rated
bin/magento setup:upgrade
bin/magento setup:di:compile
bin/magento cache:flush
bin/magento indexer:reindex catalogsearch_fulltext

The module adds the field sort_rating_summary to the product search documents. One full catalogsearch_fulltext reindex puts it into the index mapping; listings keep working before it. After enabling the option in a store view, run bin/magento catalog-sorting:metrics:refresh --metric=rating_summary, or wait for the next scheduled refresh.

Configuration

Stores › Configuration › Catalog › Catalog Sorting › Top Rated

Path Label Default Scope
catalog_sorting/rating_summary/enabled Enabled No default, website, store view

The label, the place and the visibility of the option in Sort By are set in Catalog Sorting › Sort Options. The refresh schedule is in Catalog Sorting › Popularity Data Refresh.

Registrations

Pool Item
metrics of Hryvinskyi\CatalogSortingMetrics\Model\MetricRegistry metric rating_summary, field sort_rating_summary (double)
sortFields of Hryvinskyi\CatalogSorting\Model\Search\ShopperSortFields code rating_summary on sort_rating_summary
options of Hryvinskyi\CatalogSortingOptions\Model\ListingSortOptions option rating_summary, "Top Rated", descending, sortOrder 130