From b2f133ffe639ecd7d6fb8158341208e2b24d7fb5 Mon Sep 17 00:00:00 2001 From: Jules Laplace Date: Mon, 30 Nov 2015 22:46:52 -0500 Subject: geo --- StoneIsland/www/index.html | 2 ++ 1 file changed, 2 insertions(+) (limited to 'StoneIsland/www/index.html') diff --git a/StoneIsland/www/index.html b/StoneIsland/www/index.html index 5bab617f..7bd73c84 100644 --- a/StoneIsland/www/index.html +++ b/StoneIsland/www/index.html @@ -1063,6 +1063,8 @@ + + -- cgit v1.2.3-70-g09d2 From 83a884197ff0226631a46e4894f22b8468b15598 Mon Sep 17 00:00:00 2001 From: Jules Laplace Date: Mon, 30 Nov 2015 23:11:28 -0500 Subject: add deep linking lib --- StoneIsland/www/index.html | 2 ++ StoneIsland/www/js/index.js | 2 +- StoneIsland/www/js/lib/_router.js | 11 +++++++++++ StoneIsland/www/js/lib/etc/deeplink.js | 3 +++ StoneIsland/www/js/lib/etc/push.js | 1 + 5 files changed, 18 insertions(+), 1 deletion(-) create mode 100644 StoneIsland/www/js/lib/etc/deeplink.js create mode 100644 StoneIsland/www/js/lib/etc/push.js (limited to 'StoneIsland/www/index.html') diff --git a/StoneIsland/www/index.html b/StoneIsland/www/index.html index 7bd73c84..03d4a958 100644 --- a/StoneIsland/www/index.html +++ b/StoneIsland/www/index.html @@ -1063,6 +1063,8 @@ + + diff --git a/StoneIsland/www/js/index.js b/StoneIsland/www/js/index.js index 1f2de128..e6bdf49f 100644 --- a/StoneIsland/www/js/index.js +++ b/StoneIsland/www/js/index.js @@ -69,7 +69,7 @@ var app = (function(){ app.view = null app.router = new SiteRouter () - app.account.connect( app.router.route.bind(app.router) ) + app.account.connect( app.router.launch.bind(app.router) ) $("body").removeClass("loading") } diff --git a/StoneIsland/www/js/lib/_router.js b/StoneIsland/www/js/lib/_router.js index b70d9be8..23daf4c7 100644 --- a/StoneIsland/www/js/lib/_router.js +++ b/StoneIsland/www/js/lib/_router.js @@ -47,6 +47,17 @@ var SiteRouter = Router.extend({ } } }, + + initial_route: null, + launch: function(){ + if (this.initial_route) { + this.parseRoute( this.initial_route ) + } + else { + this.route() + } + this.initial_route = null + }, go: function(url){ if (app.view && app.view.hide) { diff --git a/StoneIsland/www/js/lib/etc/deeplink.js b/StoneIsland/www/js/lib/etc/deeplink.js new file mode 100644 index 00000000..648dd167 --- /dev/null +++ b/StoneIsland/www/js/lib/etc/deeplink.js @@ -0,0 +1,3 @@ +function handleOpenURL (url) { + app.router.initial_route = url +} \ No newline at end of file diff --git a/StoneIsland/www/js/lib/etc/push.js b/StoneIsland/www/js/lib/etc/push.js new file mode 100644 index 00000000..ab0c0141 --- /dev/null +++ b/StoneIsland/www/js/lib/etc/push.js @@ -0,0 +1 @@ +// \ No newline at end of file -- cgit v1.2.3-70-g09d2 From 9497b50fa02f3cfa9cb263ce3a96fa725282d60d Mon Sep 17 00:00:00 2001 From: Jules Laplace Date: Tue, 1 Dec 2015 01:06:58 -0500 Subject: populate cartconfirm page --- StoneIsland/www/index.html | 1 - StoneIsland/www/js/lib/cart/CartConfirm.js | 103 ++++++++++++++++++++++++++++- 2 files changed, 102 insertions(+), 2 deletions(-) (limited to 'StoneIsland/www/index.html') diff --git a/StoneIsland/www/index.html b/StoneIsland/www/index.html index 03d4a958..45a04bdf 100644 --- a/StoneIsland/www/index.html +++ b/StoneIsland/www/index.html @@ -861,7 +861,6 @@
-
diff --git a/StoneIsland/www/js/lib/cart/CartConfirm.js b/StoneIsland/www/js/lib/cart/CartConfirm.js index 8a6b3c0e..171f41a1 100644 --- a/StoneIsland/www/js/lib/cart/CartConfirm.js +++ b/StoneIsland/www/js/lib/cart/CartConfirm.js @@ -2,11 +2,26 @@ var CartConfirm = FormView.extend({ el: "#cart_confirm", + template: $("#cart_confirm .template").html(), + events: { }, initialize: function(opt){ this.parent = opt.parent + this.$rows = this.$(".rows") + this.$subtotal = this.$(".subtotal") + this.$shipping = this.$(".shipping") + this.$tax = this.$(".tax") + this.$total = this.$(".total") + + this.$shipping_address = this.$(".shipping_address") + this.$shipping_method = this.$(".shipping_method") + + this.$payment_name = this.$(".payment_name") + this.$payment_method = this.$(".payment_method") + this.$payment_address = this.$(".payment_address") + this.scroller = new IScroll('#cart_confirm', app.iscroll_options) }, @@ -21,7 +36,93 @@ var CartConfirm = FormView.extend({ promise(sdk.cart.get_status).then( this.populate.bind(this) ) }, - populate: function(){ + populate: function(data){ + console.log(data) + + data = data.Cart + + this.$rows.empty() + + data.Items.forEach(function(item){ + var $el = $("
") + this.$rows.append($el) + var code_ten = item.Code10 + var size_id = item.Size + + var code = code_ten.substr(0, 8) + app.product.find(code, function(data, details){ + var descriptions = app.product.get_descriptions( details ) + + var name_partz = descriptions['ModelNames'].split(' ') + var num = name_partz.shift() + var title = name_partz.join(' ') + var type = title_case( descriptions['MicroCategory'] ) + + var color_name, size_name + + details.Item.ModelColors.some(function(color){ + if (color['Code10'] == code_ten) { + color_name = color['ColorDescription'] + return true + } + return false + }) + + details.Item.ModelSizes.some(function(size){ + if (size['SizeId'] == size_id) { + // console.log(size) + size_name = size['Default']['Text'] + size_name = SIZE_LOOKUP[ size_name ] || size_name + if (! size_name && ! size['Default']['Labeled']) { + size_name = size['Default']['Text'] + " " + size['Default']['ClassFamily'] + } + + return true + } + return false + }) + +// size_name = item.DefaultSize + " " + item.DefaultSizeClassFamily + + var t = this.template + .replace(/{{image}}/, sdk.image(item['Code10'], '11_f')) + .replace(/{{sku}}/, num) + .replace(/{{title}}/, title) + .replace(/{{type}}/, type) + .replace(/{{size}}/, size_name || "DEFAULT") + .replace(/{{color}}/, color_name || "DEFAULT") + .replace(/{{quantity}}/, 1) + .replace(/{{price}}/, as_cash(details.Item.Price.DiscountedPrice)) + $el.data("price", details.Item.Price.DiscountedPrice) + $el.html(t) + this.refreshScroller() + }.bind(this)) + }.bind(this)) + + var subtotal = data.Totals.TotalWithoutPromotions + var shipping_cost = data.DeliveryMethod.Selected.Amount.Total + var tax = data.Totals.TotalSalesTax + var total = data.Totals.TotalToPay + + this.$subtotal.html( as_cash(subtotal) ) + this.$shipping.html( as_cash(shipping_cost) ) + this.$tax.html( as_cash(tax) ) + this.$total.html( as_cash(total) ) + + var street = data.Receiver.StreetWithNumber.replace(/\n$/,"").replace("\n", ", ") + var address = data.Receiver.Name.toUpperCase() + " " + data.Receiver.Surname.toUpperCase() + "
" + street + ", " + address += data.Receiver.City + ", " + data.Receiver.Region + " " + data.Receiver.PostalCode + + this.$shipping_address.html(address) + this.$shipping_method.html(data.DeliveryMethod.Selected.Type == 1 ? "* STANDARD SHIPPING" : "* EXPRESS SHIPPING") + + var cc = data.Payment.CreditCard + var cc_street = cc.HolderAddress.replace(/\n$/,"").replace("\n", ", ") + var cc_type = cc.Type == "AmericanExpress" ? "American Express" : cc.Type + + this.$payment_name.html( cc.HolderName.toUpperCase() + " " + cc.HolderSurname.toUpperCase() ) + this.$payment_method.html( cc_type.toUpperCase() + " XXXX-XXXX-XXXX-" + cc.Last4 ) + app.curtain.hide("loading") }, -- cgit v1.2.3-70-g09d2