product detail

This commit is contained in:
merdan 2023-05-04 13:05:30 +05:00
parent 9ee6e09c64
commit c3a431f772
2 changed files with 4 additions and 4 deletions

View File

@ -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);
}

View File

@ -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()),