Class: Workarea::Storefront::CartsController
Instance Method Summary
collapse
#check_pricing_override
#check_inventory
#current_layout, #current_user_info, #health_check, #layout_content
#lookup_order, #lookup_order=
#clear_current_order, #completed_order, #completed_order=, #current_checkout, #current_order, #current_order=, #current_shipping, #current_shippings, #logout
Instance Method Details
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
# File 'app/controllers/workarea/storefront/carts_controller.rb', line 16
def add_promo_code
if Pricing.valid_promo_code?(params[:promo_code], current_checkout.email)
current_order.add_promo_code(params[:promo_code])
flash[:success] = t(
'workarea.storefront.flash_messages.promo_code_added',
promo_code: params[:promo_code]
)
redirect_to promo_code_destination
else
flash[:error] = t('workarea.storefront.flash_messages.promo_code_error')
redirect_to "#{promo_code_destination}?#{params[:promo_code].to_query(:promo_code)}"
end
end
|
#resume ⇒ Object
31
32
33
34
35
36
37
38
39
40
|
# File 'app/controllers/workarea/storefront/carts_controller.rb', line 31
def resume
if order = Order.find_by(token: params[:token]) rescue nil
self.current_order = order
flash[:success] = t('workarea.storefront.flash_messages.order_resumed')
else
flash[:error] = t('workarea.storefront.flash_messages.order_not_resumed')
end
redirect_to cart_path
end
|
#show ⇒ Object
11
12
13
14
|
# File 'app/controllers/workarea/storefront/carts_controller.rb', line 11
def show
Pricing.perform(current_order, current_shippings)
@cart = CartViewModel.new(current_order, view_model_options)
end
|