mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-01-24 20:36:49 +00:00
Load correct products on enterprise and product listing pages
This commit is contained in:
@@ -31,7 +31,14 @@ class EnterprisesController < BaseController
|
||||
@enterprise = Enterprise.find params[:id]
|
||||
|
||||
@products = []
|
||||
@products = current_order_cycle.products if current_order_cycle
|
||||
|
||||
if current_order_cycle
|
||||
@searcher = Spree::Config.searcher_class.new(options)
|
||||
@products = @searcher.retrieve_products
|
||||
|
||||
order_cycle_products = current_order_cycle.products
|
||||
@products.select! { |p| order_cycle_products.include? p }
|
||||
end
|
||||
end
|
||||
|
||||
def shop
|
||||
|
||||
@@ -6,7 +6,10 @@ Spree::ProductsController.class_eval do
|
||||
include OpenFoodWeb::SplitProductsByDistribution
|
||||
|
||||
respond_override :index => { :html => { :success => lambda {
|
||||
@products = current_order_cycle.products if current_order_cycle
|
||||
if current_order_cycle
|
||||
order_cycle_products = current_order_cycle.products
|
||||
@products.select! { |p| order_cycle_products.include? p }
|
||||
end
|
||||
} } }
|
||||
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user