hryvinskyi / magento2-catalog-sorting-reviews-count
Catalog sort option Reviews Count: the products with the most customer reviews first, taken from the review summaries by the daily popularity data refresh.
Package info
github.com/hryvinskyi/magento2-catalog-sorting-reviews-count
Type:magento2-module
pkg:composer/hryvinskyi/magento2-catalog-sorting-reviews-count
Requires
- php: ~8.1.0||~8.2.0||~8.3.0||~8.4.0||~8.5.0
- hryvinskyi/magento2-catalog-sorting: ^1.0
- hryvinskyi/magento2-catalog-sorting-metrics: ^1.0
- hryvinskyi/magento2-catalog-sorting-options: ^1.0
- magento/framework: *
- magento/module-backend: *
- magento/module-catalog: *
- magento/module-config: *
- magento/module-review: *
- magento/module-store: *
Requires (Dev)
None
Suggests
None
Provides
None
Conflicts
None
Replaces
None
README
Adds Reviews Count to the storefront Sort By list: the products with the most customer reviews first, per store view.
What it does for a store
- A Reviews Count sort order (
product_list_order=reviews_count), offered in the store views where it is enabled. A listing sorted by it opens most-reviewed first when the shopper chose no direction. - The platform's review count, per store. A product's value in a store is the
reviews_countits review summary row holds for that store. The module counts no review 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_reviews_count; no join and no computation per query. A product without reviews sorts as 0.
Requirements
- PHP 8.1 to 8.5.
hryvinskyi/magento2-catalog-sorting,hryvinskyi/magento2-catalog-sorting-optionsandhryvinskyi/magento2-catalog-sorting-metrics, ^1.0 each.- The platform's Review, Catalog, Store, Config and Backend modules (what
composer.jsonandetc/module.xmldeclare).
Installation
composer require hryvinskyi/magento2-catalog-sorting-reviews-count 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_reviews_count 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=reviews_count, or wait for the next scheduled refresh.
Configuration
Stores › Configuration › Catalog › Catalog Sorting › Reviews Count
| Path | Label | Default | Scope |
|---|---|---|---|
catalog_sorting/reviews_count/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 reviews_count, field sort_reviews_count (long) |
sortFields of Hryvinskyi\CatalogSorting\Model\Search\ShopperSortFields |
code reviews_count on sort_reviews_count |
options of Hryvinskyi\CatalogSortingOptions\Model\ListingSortOptions |
option reviews_count, "Reviews Count", descending, sortOrder 140 |