diff --git a/packages/Webkul/Product/src/Repositories/ProductRepository.php b/packages/Webkul/Product/src/Repositories/ProductRepository.php index dbbc10a50..3a686f7e7 100755 --- a/packages/Webkul/Product/src/Repositories/ProductRepository.php +++ b/packages/Webkul/Product/src/Repositories/ProductRepository.php @@ -129,11 +129,11 @@ class ProductRepository extends Repository } /** - * @param int $categoryId + * @param string $categories * * @return \Illuminate\Support\Collection */ - public function getAll($categoryId = null) + public function getAll($categories = null) { $params = request()->input(); @@ -147,7 +147,7 @@ class ProductRepository extends Repository $page = Paginator::resolveCurrentPage('page'); - $repository = app(ProductFlatRepository::class)->scopeQuery(function ($query) use ($params, $categoryId) { + $repository = app(ProductFlatRepository::class)->scopeQuery(function ($query) use ($params, $categories) { $channel = request()->get('channel') ?: (core()->getCurrentChannelCode() ?: core()->getDefaultChannelCode()); $locale = request()->get('locale') ?: app()->getLocale(); @@ -161,8 +161,8 @@ class ProductRepository extends Repository ->where('product_flat.locale', $locale) ->whereNotNull('product_flat.url_key'); - if ($categoryId) { - $qb->where('product_categories.category_id', $categoryId); + if ($categories) { + $qb->whereIn('product_categories.category_id', explode(',', $categories)); } if (! core()->getConfigData('catalog.products.homepage.out_of_stock_items')) {