->
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'
) ->
addSelect('product.active'
) ->
addSelect('ROUND(price.price*(100+tax.tax)/100,2) as price'
) ->
addSelect('manual_sorting.position as position'
) ->
addSelect('CONCAT("media/image/thumbnail/", img.img, "_140x140.", img.extension) as thumbnail'
) ->
setParameter('categoryId',
$categoryId) ->
setMaxResults($limit) ->
setFirstResult($start) ->
addGroupBy('product.id'
);
$data['data'
] =
$query->
execute()->
fetchAll();
$data['data'
] =
array_map(function D
$item) { $item['thumbnail'
] =
$this->mediaService->
getUrl($item['thumbnail'
]);
return $item;
},
$data['data'
]);
$data['total'
] =
$query->
getConnection()->
fetchColumn('SELECT FOUND_ROWS()'
);