From 130870e76a8173b1e2563b93ce8a01bdc3fd7d46 Mon Sep 17 00:00:00 2001 From: Jules Laplace Date: Sun, 2 Apr 2017 18:52:14 +0200 Subject: filter by size --- StoneIsland/www/js/lib/products/ProductView.js | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'StoneIsland/www/js/lib/products/ProductView.js') diff --git a/StoneIsland/www/js/lib/products/ProductView.js b/StoneIsland/www/js/lib/products/ProductView.js index 4ae77c1f..1c05c629 100755 --- a/StoneIsland/www/js/lib/products/ProductView.js +++ b/StoneIsland/www/js/lib/products/ProductView.js @@ -118,9 +118,9 @@ var ProductView = ScrollableView.extend({ var title = name_partz.join(' ') var type = title_case( data['MicroCategory'] ) var price = "$" + data['DiscountedPrice'] + ".00" - var details = descriptions['Details'] || "" + var details_description = descriptions['Details'] || "" var editorial = descriptions['EditorialDescription'] || "" - var body = details + " " + editorial + var body = details_description + " " + editorial // body = body.replace(/
/g, "

").replace(/(
)+$/, "") var default_color_id = this.populate_selectors(data, details) @@ -198,8 +198,11 @@ var ProductView = ScrollableView.extend({ populate_selectors: function(data, details){ var sizes = {}, colors = {}, size_lookup = {}, default_color - console.log(details['Item']['ModelColors'].length) - if (! details['Item']['ModelColors'].length) { + + var modelColors = details['Item']['ModelColors'] || [] + console.log('colors:', modelColors.length || "none") + + if (! modelColors.length) { this.not_available = true return } @@ -207,7 +210,7 @@ var ProductView = ScrollableView.extend({ this.not_available = false } - details['Item']['ModelColors'].forEach(function(color, index){ + modelColors.forEach(function(color, index){ if (! default_color || color['Code10'] == data['DefaultCode10']) { default_color = color['ColorId'] } -- cgit v1.2.3-70-g09d2