diff --git a/app/services/order_cycle_distributed_products.rb b/app/services/order_cycle_distributed_products.rb index 12aab241c7..f1b246f2dd 100644 --- a/app/services/order_cycle_distributed_products.rb +++ b/app/services/order_cycle_distributed_products.rb @@ -9,7 +9,7 @@ class OrderCycleDistributedProducts end def products_relation - Spree::Product.where(id: stocked_products) + Spree::Product.where(id: stocked_products).group("spree_products.id") end def variants_relation diff --git a/app/services/products_renderer.rb b/app/services/products_renderer.rb index 2d64ed4471..6e279a828a 100644 --- a/app/services/products_renderer.rb +++ b/app/services/products_renderer.rb @@ -63,10 +63,10 @@ class ProductsRenderer if distributor.preferred_shopfront_taxon_order.present? distributor .preferred_shopfront_taxon_order - .split(",").map { |id| "primary_taxon_id=#{id} DESC" } - .join(",") + ", name ASC" + .split(",").map { |id| "spree_products.primary_taxon_id=#{id} DESC" } + .join(", ") + ", spree_products.name ASC" else - "name ASC" + "spree_products.name ASC" end end