...
|
...
|
@@ -104,26 +104,30 @@ var Bll = { |
|
|
getBrands: function () {
|
|
|
var Brand = {};
|
|
|
$.get("/ajax/yohosearch", function (res) {
|
|
|
res.data.forEach(function (item, index) {
|
|
|
var brandAlif = (item.brand_alif || "").toUpperCase();
|
|
|
if (/^[0-9]$/.test(item.brand_alif)) {
|
|
|
brandAlif = "0-9";
|
|
|
if(!res.data||!res.data.brands){
|
|
|
return;
|
|
|
}
|
|
|
for(var key in res.data.brands){
|
|
|
var name=key;
|
|
|
if (/^[0-9]$/.test(name)) {
|
|
|
name = "0-9";
|
|
|
}
|
|
|
if (/^\W$/.test(item.brand_alif)) {
|
|
|
brandAlif = "#";
|
|
|
if (name==="") {
|
|
|
name = "#";
|
|
|
}
|
|
|
Brand[brandAlif] = Brand[brandAlif] || [];
|
|
|
Brand[brandAlif].push(item);
|
|
|
for(var key2 in res.data.brands[key]){
|
|
|
var item=res.data.brands[key][key2];
|
|
|
Brand[name] = Brand[name] || [];
|
|
|
Brand[name].push(item);
|
|
|
Bll.Brands1[item.id] = item;
|
|
|
});
|
|
|
}
|
|
|
}
|
|
|
for (var i in Brand) {
|
|
|
Brand[i].sort(function (a, b) {
|
|
|
if (a.brand_name && b.brand_name) {
|
|
|
var aName = a.brand_name.toLowerCase(),
|
|
|
bName = b.brand_name.toLowerCase();
|
|
|
if (aName < bName) return -1;
|
|
|
if (aName > bName) return 1;
|
|
|
}
|
|
|
return 0;
|
|
|
});
|
|
|
Bll.Brands.push({
|
...
|
...
|
|