Refactor #products_relation

Due to primary_taxon and supplier having moved to the variant, filtering
by_producer and by_category with a custom order involves some
complicated sql queries. So we moved the sorting logic from
ProductsRenderer to OrderCycles::DistributedProductsService so we can
keep the complicated SQL logic contained in one place
This commit is contained in:
Gaetan Craig-Riou
2024-06-17 15:52:18 +10:00
committed by zanetagebka
parent 4819fb6f62
commit 2bac76ff40

View File

@@ -71,8 +71,8 @@ module OrderCycles
distributor.preferred_shopfront_product_sorting_method
end
def supplier_property_join(query)
query.joins("
def supplier_property_join
@query = @query.joins("
JOIN enterprises ON enterprises.id = first_variant.supplier_id
LEFT OUTER JOIN producer_properties ON producer_properties.producer_id = enterprises.id
")