Image Search Issue Fixed

This commit is contained in:
devansh bawari 2021-06-29 12:47:10 +05:30
parent 63b5c53cba
commit f0f413ae41
1 changed files with 8 additions and 6 deletions

View File

@ -466,17 +466,19 @@ class ProductRepository extends Repository
} else {
$results = app(ProductFlatRepository::class)->scopeQuery(function ($query) use ($term, $channel, $locale) {
$query = $query->distinct()
->addSelect('product_flat.*')
->join('product_flat as variants', 'product_flat.id', '=', DB::raw('COALESCE(' . DB::getTablePrefix() . 'variants.parent_id, ' . DB::getTablePrefix() . 'variants.id)'))
->where('product_flat.channel', $channel)
->where('product_flat.locale', $locale)
->whereNotNull('product_flat.url_key');
if (! core()->getConfigData('catalog.products.homepage.out_of_stock_items')) {
$query = $this->checkOutOfStockItem($query);
}
return $query->distinct()
->addSelect('product_flat.*')
->where('product_flat.status', 1)
return $query->where('product_flat.status', 1)
->where('product_flat.visible_individually', 1)
->where('product_flat.channel', $channel)
->where('product_flat.locale', $locale)
->whereNotNull('product_flat.url_key')
->where(function ($subQuery) use ($term) {
$queries = explode('_', $term);