app/concerns/cart_finder.rb in artfully_ose-1.2.0 vs app/concerns/cart_finder.rb in artfully_ose-1.3.0.pre1
- old
+ new
@@ -31,9 +31,19 @@
session[session_key(klass)] = @current_cart ? @current_cart.id : nil
@current_cart
end
#
+ # Used when a user is dropping out of the widget (token-based cart)
+ # and into the storefront (session-based)
+ #
+ def attach_cart_with_token(cart_token)
+ @current_cart = Cart.find_or_create(cart_token, nil)
+ session[session_key(Cart)] = @current_cart.id
+ @current_cart
+ end
+
+ #
# Use with care. Only assign updated carts (in the case of discounts)
# TODO: Enforce that this isn't used to actually switch to another cart object
#
def current_cart=(cart)
@current_cart = cart
\ No newline at end of file