diff --git a/packages/Sarga/API/Http/Controllers/Products.php b/packages/Sarga/API/Http/Controllers/Products.php index 2a8b5ab99..f428db213 100644 --- a/packages/Sarga/API/Http/Controllers/Products.php +++ b/packages/Sarga/API/Http/Controllers/Products.php @@ -74,7 +74,7 @@ class Products extends ProductController }]); }])->find($id); - return $product; +// return $product; return ProductDetail::make($product); diff --git a/packages/Sarga/API/Http/Resources/Catalog/ProductDetail.php b/packages/Sarga/API/Http/Resources/Catalog/ProductDetail.php index 676c9a9ee..1cd80529f 100644 --- a/packages/Sarga/API/Http/Resources/Catalog/ProductDetail.php +++ b/packages/Sarga/API/Http/Resources/Catalog/ProductDetail.php @@ -25,8 +25,8 @@ class ProductDetail extends Product 'brand' => $product->brand->name ?? '', 'color' => $product->color, 'images' => ProductImage::collection($product->images), - 'color_variants' => ColorVariant::collection($this->related_products), - 'size_variants' => SizeVariant::collection($this->variants), + 'color_variants' => ColorVariant::collection($this->related_products->where('status',1)->whereHas("product_flats")), + 'size_variants' => SizeVariant::collection($this->variants->where('status',1)->whereHas("product_flats")), /* special price cases */ $this->merge($this->specialPriceInfo()),