|
...
|
...
|
@@ -53,15 +53,10 @@ class Category extends Base |
|
|
|
public static function getProductNum($cate_id){
|
|
|
|
$cate_ids = self::getChildIdsArr($cate_id);
|
|
|
|
$str = 0;
|
|
|
|
// foreach ($cate_ids as $v){
|
|
|
|
// $info = self::where('pid',$v)->first();
|
|
|
|
// if($info){
|
|
|
|
// continue;
|
|
|
|
// }else{
|
|
|
|
// $count = Product::where('category_id','like','%,'.$v.',%')->count();
|
|
|
|
// $str = $str+$count;
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
foreach ($cate_ids as $v){
|
|
|
|
$count = Product::where('category_id','like','%,'.$v.',%')->count();
|
|
|
|
$str = $str+$count;
|
|
|
|
}
|
|
|
|
return $str;
|
|
|
|
}
|
|
|
|
} |
...
|
...
|
|