Class: Locomotive::Ecommerce::OrderController

Inherits:
ApplicationController show all
Defined in:
app/controllers/locomotive/ecommerce/order_controller.rb

Instance Method Summary collapse

Methods inherited from ApplicationController

#authenticate_user!, #locomotive_user?

Methods included from EcommerceHelper

#as_currency, #current_user

Methods included from InventoryInterface

included

Methods included from EcommerceUrlHelper

#add_to_cart_path, #cart_path, #cart_update_path, #checkout_index_path, #checkout_path, #checkout_update_path, #confirm_order_path, #post_checkout_path, #purchases_path, #remove_from_cart_path

Methods included from EcommerceCartHelper

#current_user_cart

Instance Method Details

#createObject



4
5
6
7
8
# File 'app/controllers/locomotive/ecommerce/order_controller.rb', line 4

def create
  @order = current_user_cart(self).add_product_by_sku(params[:item_sku])
  flash[:success] = 'Added product to cart'
  redirect_to cart_path
end

#destroyObject



10
11
12
13
14
15
# File 'app/controllers/locomotive/ecommerce/order_controller.rb', line 10

def destroy
  @order = current_user_cart(self).remove_product_by_sku(
    params[:product_id])
  flash[:success] = 'Removed product from cart'
  redirect_to cart_path
end