diff --git a/config/application.rb b/config/application.rb index cc402859da..4793ee07f4 100644 --- a/config/application.rb +++ b/config/application.rb @@ -25,20 +25,25 @@ module Openfoodnetwork end # Register Spree calculators - initializer "spree.register.calculators" do |app| + initializer 'spree.register.calculators' do |app| app.config.spree.calculators.shipping_methods << OpenFoodNetwork::Calculator::Weight - - app.config.spree.calculators.enterprise_fees = [Calculator::FlatPercentPerItem, - Spree::Calculator::FlatRate, - Spree::Calculator::FlexiRate, - Spree::Calculator::PerItem, - Spree::Calculator::PriceSack, - OpenFoodNetwork::Calculator::Weight] - app.config.spree.calculators.payment_methods = [Spree::Calculator::FlatPercentItemTotal, - Spree::Calculator::FlatRate, - Spree::Calculator::FlexiRate, - Spree::Calculator::PerItem, - Spree::Calculator::PriceSack] + app.config.spree.calculators.add_class('enterprise_fees') + config.spree.calculators.enterprise_fees = [ + Calculator::FlatPercentPerItem, + Spree::Calculator::FlatRate, + Spree::Calculator::FlexiRate, + Spree::Calculator::PerItem, + Spree::Calculator::PriceSack, + OpenFoodNetwork::Calculator::Weight + ] + app.config.spree.calculators.add_class('payment_methods') + config.spree.calculators.payment_methods = [ + Spree::Calculator::FlatPercentItemTotal, + Spree::Calculator::FlatRate, + Spree::Calculator::FlexiRate, + Spree::Calculator::PerItem, + Spree::Calculator::PriceSack + ] end # Register Spree payment methods diff --git a/config/initializers/spree.rb b/config/initializers/spree.rb index af5d7f8245..15ccc8c1e7 100644 --- a/config/initializers/spree.rb +++ b/config/initializers/spree.rb @@ -6,7 +6,6 @@ # In order to initialize a setting do: # config.setting_name = 'new value' - require 'spree/product_filters' require 'spree/core/calculated_adjustments_decorator' @@ -41,17 +40,6 @@ end module OpenFoodNetwork end -# Add calculators category for enterprise fees -module Spree - module Core - class Environment - class Calculators - attr_accessor :enterprise_fees, :payment_methods - end - end - end -end - # Forcing spree to always allow SSL connections # Since we are using config.force_ssl = true # Without this we get a redirect loop: see https://groups.google.com/forum/#!topic/spree-user/NwpqGxJ4klk