Class: Checkout::ShippingMethodsController

Inherits:
SimplyController
  • Object
show all
Defined in:
app/controllers/nimbleshop_simply/checkout/shipping_methods_controller.rb

Instance Method Summary collapse

Instance Method Details

#load_shipping_methodsObject



20
21
22
# File 'app/controllers/nimbleshop_simply/checkout/shipping_methods_controller.rb', line 20

def load_shipping_methods
  @shipping_methods = Array.wrap(current_order.available_shipping_methods)
end

#newObject



6
7
8
# File 'app/controllers/nimbleshop_simply/checkout/shipping_methods_controller.rb', line 6

def new
  render
end

#updateObject



10
11
12
13
14
15
16
17
18
# File 'app/controllers/nimbleshop_simply/checkout/shipping_methods_controller.rb', line 10

def update
  if params[:order].present? && params[:order].keys.include?('shipping_method_id')
    current_order.update_attributes(shipping_method_id: params[:order][:shipping_method_id])
    redirect_to  new_checkout_payment_path
  else
    current_order.errors.add(:base, 'Please select a shipping method')
    render action: :new
  end
end