atrr option cat

This commit is contained in:
merdan 2022-05-19 13:45:07 +05:00
parent aa9b798ed4
commit db210a9bb9
2 changed files with 20 additions and 12 deletions

View File

@ -16,6 +16,7 @@ class CMSResource extends \Illuminate\Http\Resources\Json\JsonResource
'content' => $this->content,
'page_title' => $this->page_title,
'html_content' => $this->html_content,
'url_key' => $this->url_key,
];
}
}

View File

@ -197,6 +197,13 @@ class ProductRepository extends Repository
$qb->whereIn('product_categories.category_id', explode(',', $categoryId));
}
if(isset($params['color'])){
$qb->whereIn('product_flat.color', explode(',', $params['color']));
}
if(isset($params['size'])){
$qb->whereIn('product_flat.size', explode(',', $params['size']));
}
if (! core()->getConfigData('catalog.products.homepage.out_of_stock_items')) {
$qb = $this->checkOutOfStockItem($qb);
}
@ -209,17 +216,17 @@ class ProductRepository extends Repository
$qb->where('product_flat.visible_individually', 1);
}
if (isset($params['search'])) {
$qb->where('product_flat.name', 'like', '%' . urldecode($params['search']) . '%');
}
if (isset($params['name'])) {
$qb->where('product_flat.name', 'like', '%' . urldecode($params['name']) . '%');
}
if (isset($params['url_key'])) {
$qb->where('product_flat.url_key', 'like', '%' . urldecode($params['url_key']) . '%');
}
// if (isset($params['search'])) {
// $qb->where('product_flat.name', 'like', '%' . urldecode($params['search']) . '%');
// }
//
// if (isset($params['name'])) {
// $qb->where('product_flat.name', 'like', '%' . urldecode($params['name']) . '%');
// }
//
// if (isset($params['url_key'])) {
// $qb->where('product_flat.url_key', 'like', '%' . urldecode($params['url_key']) . '%');
// }
# sort direction
$orderDirection = 'asc';
@ -284,7 +291,7 @@ class ProductRepository extends Repository
$attributeFilters = $this->attributeRepository
->getProductDefaultAttributes(array_keys(
request()->except(['price'])
request()->except(['price','color','size'])
));
if (count($attributeFilters) > 0) {