diff --git a/packages/Sarga/API/Http/Controllers/Products.php b/packages/Sarga/API/Http/Controllers/Products.php index 8b61527..4158d10 100644 --- a/packages/Sarga/API/Http/Controllers/Products.php +++ b/packages/Sarga/API/Http/Controllers/Products.php @@ -178,7 +178,7 @@ class Products extends ProductController public function searchProducts() { // return $this->productRepository->searchProductByAttribute(request('key')); - return ProductResource::collection($this->productRepository->searchProductByAttribute(request('key'))); + return ProductResource::collection($this->productRepository->searchProductByAttributeDagdan(request('key'))); } public function discountedProducts() diff --git a/packages/Sarga/Shop/src/Repositories/ProductRepository.php b/packages/Sarga/Shop/src/Repositories/ProductRepository.php index 9c5ea4e..158451d 100644 --- a/packages/Sarga/Shop/src/Repositories/ProductRepository.php +++ b/packages/Sarga/Shop/src/Repositories/ProductRepository.php @@ -73,7 +73,7 @@ class ProductRepository extends WProductRepository return $qb->paginate($limit); } - public function searchProductByAttributeNurgul($term, $perPage) + public function searchProductByAttributeDagdan($term, $perPage) { $channel = core()->getRequestedChannelCode(); @@ -117,7 +117,11 @@ class ProductRepository extends WProductRepository ->addSelect('product_flat.*') ->where('product_flat.channel', $channel) ->where('product_flat.locale', $locale) - ->whereNotNull('product_flat.url_key'); + ->whereNotNull('product_flat.url_key') + + ->leftJoin('marketplace_products', 'product_flat.product_id', '=', 'marketplace_products.product_id') + ->leftJoin('marketplace_sellers', 'marketplace_sellers.id', '=', 'marketplace_products.marketplace_seller_id') + ->addSelect('marketplace_sellers.shop_title'); if (! core()->getConfigData('catalog.products.homepage.out_of_stock_items')) { $query = $this->checkOutOfStockItem($query);