Class: Workarea::Storefront::CartsController
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- ApplicationController
- Workarea::Storefront::CartsController
- Includes:
- CheckInventory, CheckPricingOverride
- Defined in:
- app/controllers/workarea/storefront/carts_controller.rb
Instance Method Summary collapse
Methods included from CheckPricingOverride
Methods included from CheckInventory
Methods inherited from ApplicationController
#current_layout, #current_user_info, #health_check, #layout_content
Methods included from OrderLookup
Methods included from UserActivity
#current_user_activity_id, #user_activity
Methods included from CurrentCheckout
#clear_current_order, #completed_order, #completed_order=, #current_checkout, #current_order, #current_order=, #current_shipping, #current_shippings
Methods included from HttpCaching
Instance Method Details
#add_promo_code ⇒ Object
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, ) end |