diff options
| -rwxr-xr-x | StoneIsland/www/js/lib/products/ProductView.js | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/StoneIsland/www/js/lib/products/ProductView.js b/StoneIsland/www/js/lib/products/ProductView.js index 570024b6..63f651b6 100755 --- a/StoneIsland/www/js/lib/products/ProductView.js +++ b/StoneIsland/www/js/lib/products/ProductView.js @@ -313,6 +313,7 @@ var ProductView = ScrollableView.extend({ this.sizes = sizes this.colors = colors + // console.log('populated colors', sizes, colors, default_color) return default_color }, @@ -329,6 +330,9 @@ var ProductView = ScrollableView.extend({ var option = document.createElement('option') option.value = size.value option.innerHTML = size.label + if (this.size && size.id === this.size.id) { + option.selected = true + } this.$sizeSelect.append(option) }.bind(this)) }, @@ -337,13 +341,18 @@ var ProductView = ScrollableView.extend({ if (this.sold_out) { return } if (this.notAvailable) { return } if (this.details['ModelColors'].length == 0) { return } + console.log('populate colors', this.color) this.$colorSelect.empty() Object.keys(this.colors).forEach(function(key){ var color = this.colors[key] + console.log(color) var option = document.createElement('option') option.value = key option.innerHTML = color.label + if (this.color && color.id === this.color.id) { + option.selected = true + } this.$colorSelect.append(option) }.bind(this)) }, @@ -352,7 +361,7 @@ var ProductView = ScrollableView.extend({ console.log(this.colors) var value = this.$sizeSelect.val() var size = this.sizes[value] - console.log(size) + console.log('size', size) this.set_size_label(size.label) this.size = size.value }, @@ -360,7 +369,7 @@ var ProductView = ScrollableView.extend({ select_color: function(){ var value = this.$colorSelect.val() var color = this.colors[value] - console.log(color) + console.log('color', color) this.code = color.code this.set_color_label(color.label) this.gallery.populate( color.code, this.details['ImageTypes'] ) |
