-- HikaShop version -- : 5.0.0
-- Joomla version -- : 3.10.12
-- PHP version -- : 7.3.3
-- Browser(s) name and version -- : Chrome
In my installation of Hikashop I sort the products by product_quantity in descending order so that the available items are shown first.
Many products have the same quantity (0 or 1).
In one category I have 29 products.
I fetch the products 25 at a time.
When the infinite scroll is triggered, after the 25th item, I get the same the last 4 items of the first batch of 25 items.
The problem is the same even when I turn the infinite scroll off.
After much testing, debugging and digging I think I found the root cause: in MySQL ordering by a non unique field and then applying a LIMIT with an OFFSET returns inconsistent results.
The solution is to (also) order by a unique field.
I made a tiny modification to components/com_hikashop/views/product/view.html.php, at line 749:
from:
$order = ' ORDER BY '.implode(', ', $order);
to:
$order = ' ORDER BY '.implode(', ', $order); $order .= ', b.product_id';
The problem is now fixed.
(I'm not sure if the fix will cause problem with the RAND() sorting, thou)