From 595b3ececebdf0ce17fbf14cb4871b5eaa064a99 Mon Sep 17 00:00:00 2001 From: merdan Date: Mon, 27 Mar 2023 13:39:30 +0500 Subject: [PATCH] delivery-content-mid-right --- packages/TPS/API/Http/Controllers/FilterOptions.php | 12 ++++++------ .../TPS/API/Http/Resources/Catalog/Attribute.php | 2 +- packages/TPS/API/Http/routes.php | 2 ++ 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/packages/TPS/API/Http/Controllers/FilterOptions.php b/packages/TPS/API/Http/Controllers/FilterOptions.php index bb838f992..9a6ea0744 100644 --- a/packages/TPS/API/Http/Controllers/FilterOptions.php +++ b/packages/TPS/API/Http/Controllers/FilterOptions.php @@ -55,12 +55,12 @@ class FilterOptions extends \Webkul\RestApi\Http\Controllers\V1\Shop\ResourceCon }); } - if(request()->has('brand')){ - $q->whereIn('product_attribute_values.product_id',function ($q) { - $q->select('products.id')->from('products') - ->where('products.brand_id',request()->get('brand')); - }); - } +// if(request()->has('brand')){ +// $q->whereIn('product_attribute_values.product_id',function ($q) { +// $q->select('products.id')->from('products') +// ->where('products.brand_id',request()->get('brand')); +// }); +// } $q->groupBy('integer_value'); }); diff --git a/packages/TPS/API/Http/Resources/Catalog/Attribute.php b/packages/TPS/API/Http/Resources/Catalog/Attribute.php index db3cc91b1..083d45819 100644 --- a/packages/TPS/API/Http/Resources/Catalog/Attribute.php +++ b/packages/TPS/API/Http/Resources/Catalog/Attribute.php @@ -18,7 +18,7 @@ class Attribute extends JsonResource 'id' => $this->id, 'code' => $this->code, 'name' => $this->name ?? $this->admin_name, - 'options' => AttributeOption::collection($this->options), +// 'options' => AttributeOption::collection($this->options), ]; } diff --git a/packages/TPS/API/Http/routes.php b/packages/TPS/API/Http/routes.php index acb3a447d..cb7fc1ad2 100644 --- a/packages/TPS/API/Http/routes.php +++ b/packages/TPS/API/Http/routes.php @@ -7,6 +7,7 @@ use TPS\API\Http\Controllers\CMS; use TPS\API\Http\Controllers\Customers; use TPS\API\Http\Controllers\Categories; use TPS\API\Http\Controllers\Channels; +use TPS\API\Http\Controllers\FilterOptions; use TPS\API\Http\Controllers\Orders; use TPS\API\Http\Controllers\Products; use TPS\API\Http\Controllers\Reviews; @@ -29,6 +30,7 @@ Route::group(['prefix' => 'api','middleware' => ['locale', 'currency']], functio Route::get('descendant-categories', [Categories::class, 'index'])->name('descendant-categories'); Route::get('category-brands/{id}', [Categories::class, 'brands']); Route::get('categories/{id}/filters',[Categories::class,'filters']); + Route::get('attribute-options', [FilterOptions::class, 'allResources']); /** * Product routes. */