$criteria =
new Criteria();
$criteria->
addBaseCondition(new CategoryCondition([$categoryId]));
$criteria->
addSorting(new ManualSorting());
$criteria->
offset($start);
$criteria->
limit($limit);
foreach ($customSorting->
getSortings() as $sorting) { $criteria->
addSorting($sorting);
} $query =
$this->queryBuilderFactory->
createQueryWithSorting($criteria,
$this->contextService->
getShopContext());
$data =
[];
$query ->
leftJoin('variant', 's_articles_prices', 'price', 'price.articledetailsID = variant.id
AND price.from = 1
AND price.pricegroup = \'EK\''
) ->
leftJoin('product', 's_core_tax', 'tax', 'tax.id = product.taxID'
) ->
leftJoin('product', 's_articles_img', 'img', 'img.articleID = product.id AND img.main = 1'
) ->
leftJoin('img', 's_media', 'media', 'media.id = img.media_id'
) ->
addSelect('SQL_CALC_FOUND_ROWS product.id as id'
) ->
addSelect('product.name'
)