Make product order deterministic

When products are sorted by name and two products have the same name,
their order is undefined. With pagination, two pages can have a
different order of products with the same name which then means that two
pages can return the same product.

Sorting by product id makes sure that the result is always in the same
order, for every page.
This commit is contained in:
Maikel Linke
2019-12-05 15:37:10 +11:00
parent dfa3d40665
commit d4512904ea

View File

@@ -66,7 +66,7 @@ class ProductsRenderer
.split(",").map { |id| "spree_products.primary_taxon_id=#{id} DESC" }
.join(", ") + ", spree_products.name ASC, spree_products.id ASC"
else
"spree_products.name ASC"
"spree_products.name ASC, spree_products.id"
end
end