->
addSelect($this->fieldHelper->
getUnitFields()) ->
addSelect($this->fieldHelper->
getTaxFields()) ->
addSelect($this->fieldHelper->
getPriceGroupFields()) ->
addSelect($this->fieldHelper->
getManufacturerFields()) ->
addSelect($this->fieldHelper->
getEsdFields()) ->
addSelect('(' .
$esdQuery->
getSQL() . ') as __product_has_esd'
) ->
addSelect('(' .
$customerGroupQuery->
getSQL() . ') as __product_blocked_customer_groups'
) ->
addSelect('(' .
$availableVariantQuery->
getSQL() . ') as __product_has_available_variants'
) ->
addSelect('(' .
$fallbackPriceQuery->
getSQL() . ') as __product_fallback_price_count'
) ->
addSelect('manufacturerMedia.id as __manufacturer_img_id'
) ;
$query->
setParameter(':fallback',
$context->
getFallbackCustomerGroup()->
getKey());
if ($context->
getCurrentCustomerGroup()->
getId() !==
$context->
getFallbackCustomerGroup()->
getId()) { $customerPriceQuery =
$this->
getPriceCountQuery(':current'
);
$query->
addSelect('(' .
$customerPriceQuery->
getSQL() . ') as __product_custom_price_count'
);
$query->
setParameter(':current',
$context->
getCurrentCustomerGroup()->
getKey());
} $query->
from('s_articles_details', 'variant'
) ->
innerJoin('variant', 's_articles', 'product', 'product.id = variant.articleID'
) ->
innerJoin('product', 's_core_tax', 'tax', 'tax.id = product.taxID'
) ->
leftJoin('variant', 's_core_units', 'unit', 'unit.id = variant.unitID'
) ->
leftJoin('product', 's_articles_supplier', 'manufacturer', 'manufacturer.id = product.supplierID'
) ->
leftJoin('product', 's_core_pricegroups', 'priceGroup', 'priceGroup.id = product.pricegroupID'
)