Module: Stall::CheckoutHelper

Included in:
CheckoutBaseController
Defined in:
app/helpers/stall/checkout_helper.rb

Instance Method Summary collapse

Instance Method Details

#available_shipping_methods_for(cart) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'app/helpers/stall/checkout_helper.rb', line 7

def available_shipping_methods_for(cart)
  ShippingMethod.active.ordered.select do |shipping_method|
    calculator_class = Stall::Shipping::Calculator.for(shipping_method)

    unless calculator_class
      raise Stall::Shipping::CalculatorNotFound, "        No calculator found for the shipping method : \#{ shipping_method.name }\n        (\#{ shipping_method.identifier }).\n        Please remove the Stall::ShippingMethod with id \#{ shipping_method.id }\n        or create the associated calculator with\n        `rails g stall:shipping:calculator \#{ shipping_method.identifier }`\n      MSG\n    end\n\n    calculator = calculator_class.new(cart, shipping_method)\n    calculator.available?\n  end\nend\n".squish

#step_path(*args) ⇒ Object



3
4
5
# File 'app/helpers/stall/checkout_helper.rb', line 3

def step_path(*args)
  checkout_step_path(*([current_cart.identifier] + args))
end