From c3a431f772f559dbfecc04a9dd1cd698017c5a7f Mon Sep 17 00:00:00 2001 From: merdan Date: Thu, 4 May 2023 13:05:30 +0500 Subject: [PATCH] product detail --- packages/Sarga/API/Http/Controllers/Products.php | 4 ++-- packages/Sarga/API/Http/Resources/Catalog/ProductDetail.php | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/Sarga/API/Http/Controllers/Products.php b/packages/Sarga/API/Http/Controllers/Products.php index 7882dafb3..ac2113475 100644 --- a/packages/Sarga/API/Http/Controllers/Products.php +++ b/packages/Sarga/API/Http/Controllers/Products.php @@ -62,7 +62,7 @@ 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'), 'variants' => function($query){ - $query->with(['product_flats' => function($qf){ + $query->with(['product_flats' => function($qf){ $channel = core()->getRequestedChannelCode(); $locale = 'tm';//core()->getRequestedLocaleCode(); @@ -98,7 +98,7 @@ class Products extends ProductController return $product; -// return ProductDetail::make($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 45a5af528..86c09f806 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->where('status',1)), - 'size_variants' => SizeVariant::collection($this->variants->where('status',1)), + 'color_variants' => ColorVariant::collection($this->related_products->where('status',true)), + 'size_variants' => SizeVariant::collection($this->variants->where('status',true)), /* special price cases */ $this->merge($this->specialPriceInfo()),