diff options
Diffstat (limited to 'StoneIsland/www/js/lib/cart/CartSummary.js')
| -rw-r--r-- | StoneIsland/www/js/lib/cart/CartSummary.js | 55 |
1 files changed, 52 insertions, 3 deletions
diff --git a/StoneIsland/www/js/lib/cart/CartSummary.js b/StoneIsland/www/js/lib/cart/CartSummary.js index d4729182..8e81c050 100644 --- a/StoneIsland/www/js/lib/cart/CartSummary.js +++ b/StoneIsland/www/js/lib/cart/CartSummary.js @@ -48,13 +48,62 @@ var CartSummary = ScrollableView.extend({ this.$loader.hide() app.footer.show("SHIPPING >", "CANCEL") - console.log(data) - app.header.set_cart_count(data.Cart.Items.length) this.parent.$itemcount.html(pluralize(data.Cart.Items.length, "ITEM", "S")) - this.$rows = this.$(".rows") + this.$rows.empty() + + data.Cart.Items.forEach(function(item){ + var $el = $("<div>") + this.$rows.append($el) + var code_ten = item['Code10'] + var code = code_ten.substr(0, 8) + var size_id = item['Size'] + app.product.find(code, function(data, details){ + console.log(data, details) + + var descriptions = app.product.get_descriptions( details ) + console.log(descriptions) + + 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 + console.log(code) + details.Item.ModelColors.some(function(color){ + console.log(color) + if (color['Code10'] == code_ten) { + color_name = color['ColorDescription'] + console.log(color) + 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 + return true + } + return false + }) + + 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) + .replace(/{{color}}/, color_name) + .replace(/{{quantity}}/, 1) + .replace(/{{price}}/, as_cash(details.Item.Price.DiscountedPrice)) + $el.html(t) + }.bind(this)) + }.bind(this)) var subtotal = data.Cart.Totals.TotalToPay var shipping_cost = data.Cart.DeliveryMethod.Selected.Amount.Total |
