diff options
| author | Jules Laplace <jules@okfoc.us> | 2015-11-23 01:45:53 -0500 |
|---|---|---|
| committer | Jules Laplace <jules@okfoc.us> | 2015-11-23 01:45:53 -0500 |
| commit | 7d9950316368d825510588ded16e5194b4840931 (patch) | |
| tree | 294fa8647e451eae0d741cfeb88d2173b20fd940 /StoneIsland/www/js/lib/products/ProductView.js | |
| parent | 6b37f28e2dba8f191ff5df194e5215399b696faa (diff) | |
add to cart after signin..
Diffstat (limited to 'StoneIsland/www/js/lib/products/ProductView.js')
| -rw-r--r-- | StoneIsland/www/js/lib/products/ProductView.js | 25 |
1 files changed, 19 insertions, 6 deletions
diff --git a/StoneIsland/www/js/lib/products/ProductView.js b/StoneIsland/www/js/lib/products/ProductView.js index d1a9005f..69c6e407 100644 --- a/StoneIsland/www/js/lib/products/ProductView.js +++ b/StoneIsland/www/js/lib/products/ProductView.js @@ -190,22 +190,35 @@ var ProductView = ScrollableView.extend({ }.bind(this)) }, + // ADD TO CART save: function(){ - // add to cart + auth.deferred_product = { Size: this.size, Code10: this.code } if ( ! auth.logged_in() ) { - auth.deferred_product = { size: this.size, code: this.code } + app.router.go("account/login") + app.last_view = app.cart } else if ( ! auth.has_cart() ) { - auth.deferred_product = { size: this.size, code: this.code } - auth.create_cart(auth.defer_add_to_cart) + auth.create_cart(auth.add_deferred_product_to_cart) } else { - // ADD TO CART! + auth.add_deferred_product_to_cart() } }, + // BUY NOW cancel: function(){ - // buy now + auth.deferred_product = { Size: this.size, Code10: this.code } + if ( ! auth.logged_in() ) { + app.go("account/login") + app.last_view = app.cart + } + else if ( ! auth.has_cart() ) { + auth.create_cart(auth.add_deferred_product_to_cart) + } + else { + app.go("cart") + auth.add_deferred_product_to_cart() + } }, back: function(){ |
