summaryrefslogtreecommitdiff
path: root/StoneIsland/www/js/lib/products/ProductView.js
diff options
context:
space:
mode:
authorJules Laplace <jules@okfoc.us>2017-04-02 18:52:14 +0200
committerJules Laplace <jules@okfoc.us>2017-04-02 18:52:14 +0200
commit130870e76a8173b1e2563b93ce8a01bdc3fd7d46 (patch)
treeca33326936fea92aa86d4693eedf1a607918774a /StoneIsland/www/js/lib/products/ProductView.js
parent3a12871d8513c1daed9d0309b10df3b40105dad9 (diff)
filter by size
Diffstat (limited to 'StoneIsland/www/js/lib/products/ProductView.js')
-rwxr-xr-xStoneIsland/www/js/lib/products/ProductView.js13
1 files changed, 8 insertions, 5 deletions
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(/<br>/g, "<br><br>").replace(/(<br>)+$/, "")
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']
}