filter options
This commit is contained in:
parent
785cc33f31
commit
6c50b24554
|
|
@ -63,7 +63,7 @@ class Brands extends \Webkul\RestApi\Http\Controllers\V1\Shop\ResourceController
|
|||
$query = $query->orderBy('position', 'desc')->orderBy('name', 'asc');
|
||||
}
|
||||
|
||||
return $query;
|
||||
return $query->has('products');
|
||||
});
|
||||
|
||||
if (is_null($request->input('pagination')) || $request->input('pagination')) {
|
||||
|
|
|
|||
|
|
@ -33,16 +33,14 @@ class Categories extends CategoryController
|
|||
|
||||
public function filters($id){
|
||||
$category = $this->getRepositoryInstance()->with(['filterableAttributes','brands' => function ($q){
|
||||
$q->take(20)->orderBy('position', 'desc')->orderBy('name', 'asc');
|
||||
$q->has('products')->take(20)->orderBy('position', 'desc')->orderBy('name', 'asc');
|
||||
} ])
|
||||
->find($id);
|
||||
|
||||
$brendler = $category->brands()->has('products')->get();
|
||||
|
||||
if($category)
|
||||
return response([
|
||||
'attributes' => Attribute::collection($category->filterableAttributes),
|
||||
'brands' => Brand::collection($brendler),
|
||||
'brands' => Brand::collection($category->brands),
|
||||
]);
|
||||
else{
|
||||
return response(['error'=>'not found'],404);
|
||||
|
|
|
|||
Loading…
Reference in New Issue