|
@@ -44,11 +44,18 @@ class brands_special
|
|
|
foreach ($blocks as $block)
|
|
|
{
|
|
|
$items = $block['items'];
|
|
|
+ if(empty($items) || is_array($items) == false) continue;
|
|
|
+
|
|
|
+ foreach ($items as $item)
|
|
|
+ {
|
|
|
+ $brand_id = intval($item['data']);
|
|
|
+ $data = $item;
|
|
|
+ $data['scale'] = $block['scale'];
|
|
|
+
|
|
|
+ self::$stBImgContianers[$brand_id] = $data;
|
|
|
+ }
|
|
|
if(!empty($items) && is_array($items)) {
|
|
|
- $brand_id = intval($items[0]['data']);
|
|
|
- $item = $items[0];
|
|
|
- $item['scale'] = $block['scale'];
|
|
|
- self::$stBImgContianers[$brand_id] = $item;
|
|
|
+
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -78,33 +85,46 @@ class special_helper
|
|
|
$this->special_id = $special_id;
|
|
|
$this->read_cache();
|
|
|
}
|
|
|
+
|
|
|
+ public static function format_brand_sale($brand_id,$can_click)
|
|
|
+ {
|
|
|
+ if($brand_id <= 0) return array();
|
|
|
+
|
|
|
+ $helper = new brands_special();
|
|
|
+ $info = $helper->info($brand_id);
|
|
|
+ if($info == false) return array();
|
|
|
+
|
|
|
+ $result['item_title'] = '';
|
|
|
+ $result['item_type'] = 'home1';
|
|
|
+ $result['scale'] = $info['scale'];
|
|
|
+
|
|
|
+ $item['image'] = $info['image'];
|
|
|
+ $item['type'] = $info['type'];
|
|
|
+ if($can_click == true) {
|
|
|
+ $item['data'] = $info['data'];
|
|
|
+ } else {
|
|
|
+ $item['data'] = 0;
|
|
|
+ }
|
|
|
+
|
|
|
+ $item['title'] = $info['title'];
|
|
|
+ $result['items'][] = $item;
|
|
|
+
|
|
|
+ return $result;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
public static function format_brand($brands)
|
|
|
{
|
|
|
if(empty($brands)) return array();
|
|
|
|
|
|
- $result = [];
|
|
|
if(count($brands) == 1)
|
|
|
{
|
|
|
$brand_id = intval($brands[0]['data']);
|
|
|
- if($brand_id <= 0) return array();
|
|
|
-
|
|
|
- $helper = new brands_special();
|
|
|
- $info = $helper->info($brand_id);
|
|
|
- if($info == false) return array();
|
|
|
-
|
|
|
- $result['item_title'] = '';
|
|
|
- $result['item_type'] = 'home1';
|
|
|
- $result['scale'] = $info['scale'];
|
|
|
-
|
|
|
- $item['image'] = $info['image'];
|
|
|
- $item['type'] = $info['type'];
|
|
|
- $item['data'] = $info['data'];
|
|
|
- $item['title'] = $info['title'];
|
|
|
-
|
|
|
- $result['items'][] = $item;
|
|
|
+ return self::format_brand_sale($brand_id,true);
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
+ $result = [];
|
|
|
$result['item_title'] = '';
|
|
|
$result['item_type'] = 'homewords';
|
|
|
|
|
@@ -116,15 +136,16 @@ class special_helper
|
|
|
|
|
|
$result['items'][] = $item;
|
|
|
}
|
|
|
- }
|
|
|
|
|
|
- return $result;
|
|
|
+ return $result;
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
public static function format_category($cats,$title = '')
|
|
|
{
|
|
|
- $result = [];
|
|
|
+ if(empty($cats)) return array();
|
|
|
|
|
|
+ $result = [];
|
|
|
$result['item_title'] = $title;
|
|
|
$result['item_type'] = 'homewords';
|
|
|
|