$query->
from('s_articles_details', 'availableVariant'
);
$query->
innerJoin('availableVariant', 's_articles', 'product', 'availableVariant.articleId = product.id'
);
$query->
innerJoin('prices', 's_article_configurator_option_relations', 'relations', 'relations.article_id = prices.articledetailsID'
);
$query->
innerJoin('relations', 's_article_configurator_options', 'options', 'relations.option_id = options.id'
);
$priceListingQuery =
$this->connection->
createQueryBuilder();
$priceTable =
$this->listingPriceHelper->
getPriceTable($context);
$priceTable->
andWhere('defaultPrice.articledetailsID IN (:variants)'
);
$priceListingQuery->
select('DISTINCT prices.`articledetailsID` as articledetailsID'
);
$priceListingQuery->
addSelect('prices.`articleID` as articleID'
);
$priceListingQuery->
addSelect($this->listingPriceHelper->
getSelection($context) . 'as price'
);
$priceListingQuery->
from('s_articles', 'product'
);
$priceListingQuery->
innerJoin('product', 's_articles_details', 'availableVariant', 'availableVariant.articleId = product.id'
);
$priceListingQuery->
innerJoin('prices', 's_article_configurator_option_relations', 'relations', 'relations.article_id = prices.articledetailsID'
);
$priceListingQuery->
innerJoin('relations', 's_article_configurator_options', 'options', 'relations.option_id = options.id'
);
$priceListingQuery->
innerJoin('product', 's_core_tax', 'tax', 'tax.id = product.taxID'
);
$this->listingPriceHelper->
joinPriceGroup($priceListingQuery);
$priceListingQuery->
andWhere('prices.articleID IN (:products)'
);
$priceListingQuery->
andWhere('prices.articledetailsID IN (:variants)'
);
$onSalePriceListingQuery =
clone $priceListingQuery;