product detail
This commit is contained in:
parent
b9f6e44f2e
commit
e0330b7b0f
|
|
@ -82,7 +82,11 @@ class Products extends ProductController
|
||||||
|
|
||||||
public function testProduct($id){
|
public function testProduct($id){
|
||||||
$product = $this->productRepository->select('id','attribute_family_id','type','brand_id')
|
$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'),
|
->with(['brand','related_products'=> fn($rp) => $rp->select('id','type','attribute_family_id','brand_id')
|
||||||
|
->with('brand')
|
||||||
|
->whereHas('product_flat', function($qwh){
|
||||||
|
$qwh->where('status',1);
|
||||||
|
}),
|
||||||
'variants' => function($query){
|
'variants' => function($query){
|
||||||
$query->whereHas('product_flat', function($qwh){
|
$query->whereHas('product_flat', function($qwh){
|
||||||
$qwh->where('status',1);
|
$qwh->where('status',1);
|
||||||
|
|
|
||||||
|
|
@ -25,8 +25,8 @@ class ProductDetail extends Product
|
||||||
'brand' => $product->brand->name ?? '',
|
'brand' => $product->brand->name ?? '',
|
||||||
'color' => $product->color,
|
'color' => $product->color,
|
||||||
'images' => ProductImage::collection($product->images),
|
'images' => ProductImage::collection($product->images),
|
||||||
'color_variants' => ColorVariant::collection($this->related_products->where('status',true)),
|
'color_variants' => ColorVariant::collection($this->related_products),
|
||||||
'size_variants' => SizeVariant::collection($this->variants->where('status',true)),
|
'size_variants' => SizeVariant::collection($this->variants),
|
||||||
/* special price cases */
|
/* special price cases */
|
||||||
$this->merge($this->specialPriceInfo()),
|
$this->merge($this->specialPriceInfo()),
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue