From 0805b9a105f6cb12ffb23349e1458d13ffd90d4f Mon Sep 17 00:00:00 2001 From: Jules Laplace Date: Thu, 19 Nov 2015 23:17:05 -0500 Subject: dates and some cart auth --- StoneIsland/www/js/lib/products/ProductView.js | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'StoneIsland/www/js/lib/products') diff --git a/StoneIsland/www/js/lib/products/ProductView.js b/StoneIsland/www/js/lib/products/ProductView.js index e21c28f1..5fe1fe7b 100644 --- a/StoneIsland/www/js/lib/products/ProductView.js +++ b/StoneIsland/www/js/lib/products/ProductView.js @@ -185,13 +185,22 @@ var ProductView = ScrollableView.extend({ return this.colors[key] }.bind(this)) app.selector.select(colors, function(color){ - this.color = color.value + this.code = color.code this.$color.html(color.label) }.bind(this)) }, save: function(){ // add to cart + if ( ! auth.logged_in() ) { + auth.defer_add_to_cart = { size: this.size, code: this.code } + } + else if ( ! auth.has_cart() ) { + auth.deferred_product = { size: this.size, code: this.code } + auth.create_cart(auth.defer_add_to_cart) + } + else { + } }, cancel: function(){ -- cgit v1.2.3-70-g09d2