diff options
| author | Jules Laplace <julescarbon@gmail.com> | 2020-08-04 17:21:53 +0200 |
|---|---|---|
| committer | Jules Laplace <julescarbon@gmail.com> | 2020-08-04 17:21:53 +0200 |
| commit | 9e9d6dd6ee433d25516f4a686d58b764ef9abc1a (patch) | |
| tree | fc0416629e48fc4c58286db5ab26e793a863d067 | |
| parent | ad077fd63b3d738d89e77e0632c1bcb4330c1b1a (diff) | |
fix style select bug
| -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'] ) |
