Installation and Configuration Guide for the 'Product Sorting by Popularity' Module for Magento 2
1. Installing the module via Composer
Follow the steps below to correctly install the module in your Magento 2 store:
Step 1: Add repositories to the Composer configuration
composer config repositories.popularity vcs https://github.com/kowalco/module-popularitycomposer config repositories.attributes.query vcs https://github.com/kowalco/magento-2-attributes-queryStep 2: Add an access token for the private GitHub repository
composer config --global --auth github-oauth.github.com Step 3: Install the module using Composer
composer require kowal/module-popularityStep 4: Enable the module in Magento 2
php bin/magento module:enable Kowal_PopularityStep 5: Apply database updates
php bin/magento setup:upgradeStep 6: Flush the Magento cache
php bin/magento cache:flush2. Module configuration in the Magento admin panel
After installing the module, go to the Magento admin panel and complete the steps below:
a) Module settings:
- Go to Stores → Configuration → Kowal → Popularity.
- Enable or disable the module using the 'Enable Module' field.
- Set the popularity analysis period in days in the 'Sales Analysis Period' field.
- Select the order statuses that should be included in the popularity analysis.
- Select the store views that should be excluded from popularity calculations.
- Save the configuration.
b) Setting sorting by the 'popularity' attribute:
- Go to Stores → Configuration → Catalog → Catalog → Product Listing.
- In the 'Available Sort By' section, make sure the 'Popularity' attribute has been added.
- In the 'Default Sort By' section, you can set 'Popularity' as the default product sorting method.
- Save the configuration.
After completing these steps, your Magento 2 store will automatically sort products by their popularity.
























