$priceTable =
$this->listingPriceHelper->
getPriceTable($context);
$priceTable->
innerJoin('defaultPrice', 's_articles_details', 'details', 'details.id = defaultPrice.articledetailsID'
);
$priceTable->
andWhere('(details.laststock * details.instock) >= (details.laststock * details.minpurchase)'
);
$priceTable->
andWhere('details.active = 1'
);
$query->
from('s_articles', 'product'
);
$query->
innerJoin('product', '(' .
$priceTable->
getSQL() . ')', 'prices', 'product.id = prices.articleID'
);
$query->
innerJoin('prices', 's_articles_details', 'variant', 'variant.id = prices.articledetailsID AND variant.active = 1'
);
$query->
innerJoin('product', 's_core_tax', 'tax', 'tax.id = product.taxID'
);
$this->
joinAvailableVariant($query);
$query->
andWhere('prices.articledetailsID = availableVariant.id'
);
$this->listingPriceHelper->
joinPriceGroup($query);
$conditions =
$criteria->
getConditionsByClass(VariantCondition::
class);
/** @var VariantCondition $condition */
foreach ($conditions as $condition) { if (!
$condition->
expandVariants()) { continue;
}