Class: Comable::CartsController

Inherits:
ApplicationController show all
Defined in:
app/controllers/comable/carts_controller.rb

Instance Method Summary collapse

Instance Method Details

#addObject



5
6
7
8
9
10
11
12
13
# File 'app/controllers/comable/carts_controller.rb', line 5

def add
  cart_item = find_cart_item
  return redirect_by_product_not_found unless cart_item

  current_customer.add_cart_item(cart_item, cart_item_options)

  flash[:notice] = I18n.t('comable.carts.add_product')
  redirect_to cart_path
end

#updateObject



15
16
17
18
19
20
21
22
23
# File 'app/controllers/comable/carts_controller.rb', line 15

def update
  cart_item = find_cart_item
  return redirect_by_product_not_found unless cart_item

  current_customer.reset_cart_item(cart_item, cart_item_options)

  flash[:notice] = I18n.t('comable.carts.update')
  redirect_to cart_path
end