diff --git a/packages/Sarga/API/Http/Controllers/Products.php b/packages/Sarga/API/Http/Controllers/Products.php index bbd4fc6ff..d25bac587 100644 --- a/packages/Sarga/API/Http/Controllers/Products.php +++ b/packages/Sarga/API/Http/Controllers/Products.php @@ -62,23 +62,14 @@ class Products extends ProductController $product = $this->productRepository->select('id','attribute_family_id','type','brand_id') ->with(['brand','related_products'=> fn($rp) => $rp->select('id','type','attribute_family_id','brand_id') ->with('brand') - ->whereHas('product_flat', function($qwh){ + ->whereHas('product_flats', function($qwh){ $qwh->where('status',1); }), 'variants' => function($query){ - $query->whereHas('product_flat', function($qwh){ + $query->whereHas('product_flats', function($qwh){ $qwh->where('status',1); }); - $query->with(['product_flats' => function($qf){ - $channel = core()->getRequestedChannelCode(); - - $locale = 'tm';//core()->getRequestedLocaleCode(); - - $qf->where('product_flat.channel', $channel) - ->where('product_flat.locale', $locale) -// ->whereNotNull('product_flat.url_key') - ->where('product_flat.status',1); - }]); + $query->with('product_flats'); }])->find($id); // return $product;