From 98deea74d004865335e3c3c7aa1dcc9e216ae6ad Mon Sep 17 00:00:00 2001 From: merdan Date: Tue, 11 Apr 2023 13:53:01 +0500 Subject: [PATCH] product detail --- packages/Sarga/API/Http/Controllers/Products.php | 2 +- packages/Sarga/API/Http/Resources/Catalog/ProductDetail.php | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) 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()),