diff --git a/packages/Sarga/API/Http/Resources/Catalog/Product.php b/packages/Sarga/API/Http/Resources/Catalog/Product.php index 39e75c7..e9c3137 100644 --- a/packages/Sarga/API/Http/Resources/Catalog/Product.php +++ b/packages/Sarga/API/Http/Resources/Catalog/Product.php @@ -54,7 +54,8 @@ class Product extends JsonResource //'logo' => $this->logo ? Storage::url($this->logo) : null, 'new' => $this->new, 'featured' => $this->featured, - 'qty' => $product->qty, + 'qty' => $this->qty, + 'status' => $this->status, // 'brand' => $product->brand->name ?? '', diff --git a/packages/Sarga/Shop/src/Repositories/ProductRepository.php b/packages/Sarga/Shop/src/Repositories/ProductRepository.php index 33d2b57..dd120b9 100644 --- a/packages/Sarga/Shop/src/Repositories/ProductRepository.php +++ b/packages/Sarga/Shop/src/Repositories/ProductRepository.php @@ -520,8 +520,8 @@ class ProductRepository extends WProductRepository AND product_flat.special_price_to IS NOT NULL , IF( NOW( ) >= product_flat.special_price_from AND NOW( ) <= product_flat.special_price_to, IF( product_flat.special_price IS NULL OR product_flat.special_price = 0 , product_flat.price, LEAST( product_flat.special_price, product_flat.price ) ) , product_flat.price ) , IF( product_flat.special_price_from IS NULL , IF( product_flat.special_price_to IS NULL , IF( product_flat.special_price IS NULL OR product_flat.special_price = 0 , product_flat.price, LEAST( product_flat.special_price, product_flat.price ) ) , IF( NOW( ) <= product_flat.special_price_to, IF( product_flat.special_price IS NULL OR product_flat.special_price = 0 , product_flat.price, LEAST( product_flat.special_price, product_flat.price ) ) , product_flat.price ) ) , IF( product_flat.special_price_to IS NULL , IF( NOW( ) >= product_flat.special_price_from, IF( product_flat.special_price IS NULL OR product_flat.special_price = 0 , product_flat.price, LEAST( product_flat.special_price, product_flat.price ) ) , product_flat.price ) , product_flat.price ) ) ) AS price1')) ->leftJoin('products', 'product_flat.product_id', '=', 'products.id') - // ->leftJoin('product_inventories', 'product_flat.product_id', '=', 'product_inventories.product_id') - // ->addSelect() + ->leftJoin('product_inventories', 'products.id', '=', 'product_inventories.product_id') + ->addSelect('product_inventories.qty') ->leftJoin('marketplace_products', 'product_flat.product_id', '=', 'marketplace_products.product_id') ->where('product_flat.channel', $channel) ->where('product_flat.locale', $locale)