Browse Source

fix empty categories

master 1.2.4
CAGETTE DEPLOYER 4 years ago
parent
commit
93f3d362a4
  1. 12
      js/ShopCart.hx

12
js/ShopCart.hx

@ -164,7 +164,13 @@ class ShopCart
var groups = new Map<Int,{name:String,products:Array<ProductInfo>}>(); var groups = new Map<Int,{name:String,products:Array<ProductInfo>}>();
var pinned = new Map<Int,{name:String,products:Array<ProductInfo>}>(); var pinned = new Map<Int,{name:String,products:Array<ProductInfo>}>();
var firstCategGroup = this.categories[0].categs;
trace(this.categories);
var firstCategGroup = null;
if (this.categories.length > 0){
firstCategGroup = this.categories[0].categs;
}
//trace(firstCategGroup); //trace(firstCategGroup);
//trace(pinnedCategories); //trace(pinnedCategories);
@ -181,7 +187,7 @@ class ShopCart
for ( categ in p.categories){ for ( categ in p.categories){
if (Lambda.find(firstCategGroup, function(c) return c.id == categ) != null){
if (firstCategGroup != null && Lambda.find(firstCategGroup, function(c) return c.id == categ) != null){
//is in this category group //is in this category group
var g = groups.get(categ); var g = groups.get(categ);
@ -442,4 +448,4 @@ class ShopCart
} }
}
}
Loading…
Cancel
Save