Skip to content

Commit

Permalink
Document temporary solution for category filtering
Browse files Browse the repository at this point in the history
  • Loading branch information
rioug authored and dacook committed Feb 21, 2024
1 parent a045152 commit 5840c81
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions app/services/order_cycle_distributed_products.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,12 @@ def products_relation
Spree::Product.where(id: stocked_products).group("spree_products.id")
end

# Joins on the first product variant to allow us to filter product by taxon. This is so
# enterprise can display product sorted by category in a custom order on their shopfront.
#
# Caveat, the category sorting won't work properly if there are multiple variant with different
# category for a given product.
#
def products_taxons_relation
Spree::Product.where(id: stocked_products).
joins("LEFT JOIN (SELECT DISTINCT ON(product_id) id, product_id, primary_taxon_id
Expand Down

0 comments on commit 5840c81

Please sign in to comment.