Inconsistent behaviour on different subpages if website has too few orders

Created on 6 December 2022, over 1 year ago
Updated 11 February 2023, over 1 year ago

Problem/Motivation

If the website has not a lot of orders or some items were ordered the same amount of time, the best selling products can become inconsistent throughout the website.

In my case, I had a website with not a lot of orders, but also not very few. I was showing 5 of the best selling products but only the first 2 were matching throughout the website, the rest were kind of random from subpage to subpage.

I noticed disabling caching or clearing the website caches does not solve the issue, so I checked the query and it looks like my top 2 selling products were sold only 3 times and the rest of the products (many, website has hundreds of products but rarely people buy the same product multiple times) 2 times, but the query result was each time different. Not sure why that is, but to make it consistent I added the following line to the query:

$query->orderBy('pvfd.product_id', 'DESC');

in file ProductsService.php

I am sure this can be solved in theme by altering the query as well but I am using a bit older version of this module.

Btw thanks for the module!

πŸ› Bug report
Status

Fixed

Version

2.1

Component

Code

Created by

πŸ‡ΈπŸ‡°Slovakia lubwn

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • πŸ‡ΊπŸ‡¦Ukraine artsays

    Dear, lubwn!
    This happens cause some products has the same quantity of orders and in each query to database you have received random sequences of products from the list of the products with the same quantity of orders.

    I have created a patch for you case and option for content editor to espablish strict sequences of products. It will be checkbox in block configuration "Strict sequences of products" by default it is going to be FALSE

    Will coming with future module release!

    Thanks for case)

  • Status changed to RTBC over 1 year ago
  • Status changed to Fixed over 1 year ago
  • Status changed to Fixed over 1 year ago
Production build 0.69.0 2024