Description
Preconditions (*)
Magento 2.4.x
Steps to reproduce (*)
- View multiple products as a guest or customer on frontend from different browsers so there will be multiple entires in report_event and report_viewed_product_index table.
- If already have visitor logs and data in report_event and report_viewed_product_index tables that will be great.
- Login into Admin and refresh lifetime static data for product view from Reports -> STATISTICS -> Refresh Statistics.
- Open Product Views Report from Reports -> PRODUCTS -> Views
- Select rage and show reports.
- You will see the views of products.
- Now run cron to run manually change the expression of visitor_clean cron to run now * * * * * . and run bin/magento cron:run
- you will see data from customer_visitor and report_event cleaned.
- now repeat steps 3 to 6, Product view log will not be show but data in report_viewed_product_index still exists.
Expected result (*)
Report for the view products must be shown because logs exists in the table report_viewed_product_index.
Actual result (*)
Most viewed product reports does not show the correct report.
Description
Everyday a midnight the cron job 'visitor_clean' cleans the visitors log. This is done by \Magento\Customer\Model\Visitor::clean() which calls \Magento\Customer\Model\ResourceModel\Visitor::clean().
The module "Magento_Reports" has a plugin "afterClean" for \Magento\Customer\Model\ResourceModel\Visitor::clean().
This plugin removes all entries from 'report_event' which points to an non existing entry in 'customer_visitor'.
So when you updating the livetime statistics now. A lot of entries are missing.
Additional Information (*)
When cron cleans visitor log, report_event table also get clean from app/code/Magento/Reports/Model/ResourceModel/Event.php:180
When we run lifetime statics refresh it collects all data by joining report_event table in app/code/Magento/Reports/Model/ResourceModel/Report/Product/Viewed.php:10
4. In collection it ignores the damaged data which has been removed in clean process.
Please provide Severity assessment for the Issue as Reporter. This information will help during Confirmation and Issue triage processes.
- [x ] Severity: S0 - Affects critical data or functionality and leaves users without workaround.
- Severity: S1 - Affects critical data or functionality and forces users to employ a workaround.
- Severity: S2 - Affects non-critical data or functionality and forces users to employ a workaround.
- Severity: S3 - Affects non-critical data or functionality and does not force users to employ a workaround.
- Severity: S4 - Affects aesthetics, professional look and feel, “quality” or “usability”.