From a176efe6e51420d0bf9735f5caf8808cbdc97bd8 Mon Sep 17 00:00:00 2001 From: merdan Date: Thu, 22 Sep 2022 13:37:07 +0500 Subject: [PATCH] menu Controller --- packages/Sarga/API/Http/Resources/Catalog/Product.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/packages/Sarga/API/Http/Resources/Catalog/Product.php b/packages/Sarga/API/Http/Resources/Catalog/Product.php index 24af419ac..6e6d83a0d 100644 --- a/packages/Sarga/API/Http/Resources/Catalog/Product.php +++ b/packages/Sarga/API/Http/Resources/Catalog/Product.php @@ -83,7 +83,13 @@ class Product extends JsonResource */ private function specialPriceInfo() { - $product = $this->type == 'configurable' ? $this->product->getTypeInstance()->getMinPriceVariant()->product : $this->product; + if($this->type == 'configurable') + { + $variant = $this->variants()->with('product')->orderBy('min_price')->first(); + $product = $variant->product; + }else{ + $product = $this->product ? $this->product : $this; + } $typeInstance = $product->getTypeInstance();