->
addSelect('variantCheapestPrice.different_price_count as __different_price_count'
);
$mainQuery->
from('s_articles_prices', 'price'
) ->
innerJoin('price', 's_articles_details', 'variant', 'variant.id = price.articledetailsID'
) ->
innerJoin('variant', 's_articles', 'product', 'product.id = variant.articleID'
) ->
leftJoin('variant', 's_core_units', 'unit', 'unit.id = variant.unitID'
) ->
leftJoin('price', 's_articles_prices_attributes', 'priceAttribute', 'priceAttribute.priceID = price.id'
) ->
innerJoin('price', '(' .
$cheapestPriceQuery->
getSQL() . ')', 'variantCheapestPrice', 'variantCheapestPrice.id = price.id'
);
$this->fieldHelper->
addUnitTranslation($mainQuery,
$context);
$this->fieldHelper->
addProductTranslation($mainQuery,
$context);
$this->fieldHelper->
addVariantTranslation($mainQuery,
$context);
$this->fieldHelper->
addPriceTranslation($mainQuery,
$context);
$mainQuery->
setParameter(':customerGroup',
$context->
getCurrentCustomerGroup()->
getKey()) ->
setParameter(':fallbackCustomerGroup',
$context->
getFallbackCustomerGroup()->
getKey()) ->
setParameter(':variants',
$variantIds, Connection::PARAM_INT_ARRAY
) ->
setParameter(':priceGroupCustomerGroup',
$customerGroup->
getId());
$data =
$mainQuery->
execute()->
fetchAll(PDO::FETCH_ASSOC
);
$prices =
[];
foreach ($data as $row) {