mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-03-06 02:51:34 +00:00
Pass quantity to OrderPopulator
This commit is contained in:
@@ -5,13 +5,13 @@ Spree::OrdersController.class_eval do
|
||||
before_filter :update_distribution, :only => :update
|
||||
before_filter :filter_order_params, :only => :update
|
||||
|
||||
# Patch Orders#populate to provide distributor_id and order_cycle_id to OrderPopulator
|
||||
# Patch Orders#populate to populate multi_cart (if enabled)
|
||||
def populate
|
||||
if OpenFoodNetwork::FeatureToggle.enabled? :multi_cart
|
||||
populate_cart params.slice(:products, :variants, :quantity, :distributor_id, :order_cycle_id)
|
||||
end
|
||||
populator = Spree::OrderPopulator.new(current_order(true), current_currency)
|
||||
if populator.populate(params.slice(:products, :variants))
|
||||
if populator.populate(params.slice(:products, :variants, :quantity))
|
||||
fire_event('spree.cart.add')
|
||||
fire_event('spree.order.contents_changed')
|
||||
respond_with(@order) do |format|
|
||||
|
||||
Reference in New Issue
Block a user