|
...
|
...
|
@@ -38,7 +38,7 @@ class CategoryController extends BaseController |
|
|
|
if(!empty($list)){
|
|
|
|
foreach ($list as $k =>$v){
|
|
|
|
$v['url'] = $this->user['domain'] . $v['route'];
|
|
|
|
$v['product_num'] = Product::where('category_id','like' ,'%,'.$v['id'].',%')->count();;
|
|
|
|
$v['product_num'] = Product::where('category_id','like' ,'%,'.$v['id'].',%')->count();
|
|
|
|
$v['image_link'] = getImageUrl($v['image']);
|
|
|
|
$list[$k] = $v;
|
|
|
|
}
|
|
...
|
...
|
@@ -75,6 +75,10 @@ class CategoryController extends BaseController |
|
|
|
$v = (array)$v;
|
|
|
|
if ($v['pid'] == 0) {
|
|
|
|
$v['sub'] = _get_child($v['id'], $list);
|
|
|
|
foreach ($v['sub'] as $sub){
|
|
|
|
$v['product_num'] += $sub['product_num'];
|
|
|
|
}
|
|
|
|
|
|
|
|
$data[] = $v;
|
|
|
|
}
|
|
|
|
}
|
...
|
...
|
|