Add marketplace seller to search repository

This commit is contained in:
Amanmyrat 2023-09-21 12:46:35 +05:00
parent aa22a62924
commit 2cfabfc735
2 changed files with 7 additions and 3 deletions

View File

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

View File

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