|
@@ -38,7 +38,7 @@ class CategoryController extends BaseController |
|
@@ -38,7 +38,7 @@ class CategoryController extends BaseController |
|
38
|
if(!empty($list)){
|
38
|
if(!empty($list)){
|
|
39
|
foreach ($list as $k =>$v){
|
39
|
foreach ($list as $k =>$v){
|
|
40
|
$v['url'] = $this->user['domain'] . $v['route'];
|
40
|
$v['url'] = $this->user['domain'] . $v['route'];
|
|
41
|
- $v['product_num'] = Product::where('category_id','like' ,'%,'.$v['id'].',%')->count();;
|
41
|
+ $v['product_num'] = Product::where('category_id','like' ,'%,'.$v['id'].',%')->count();
|
|
42
|
$v['image_link'] = getImageUrl($v['image']);
|
42
|
$v['image_link'] = getImageUrl($v['image']);
|
|
43
|
$list[$k] = $v;
|
43
|
$list[$k] = $v;
|
|
44
|
}
|
44
|
}
|
|
@@ -75,6 +75,10 @@ class CategoryController extends BaseController |
|
@@ -75,6 +75,10 @@ class CategoryController extends BaseController |
|
75
|
$v = (array)$v;
|
75
|
$v = (array)$v;
|
|
76
|
if ($v['pid'] == 0) {
|
76
|
if ($v['pid'] == 0) {
|
|
77
|
$v['sub'] = _get_child($v['id'], $list);
|
77
|
$v['sub'] = _get_child($v['id'], $list);
|
|
|
|
78
|
+ foreach ($v['sub'] as $sub){
|
|
|
|
79
|
+ $v['product_num'] += $sub['product_num'];
|
|
|
|
80
|
+ }
|
|
|
|
81
|
+
|
|
78
|
$data[] = $v;
|
82
|
$data[] = $v;
|
|
79
|
}
|
83
|
}
|
|
80
|
}
|
84
|
}
|