$currency =
$context->
getCurrency();
$priceField = 'defaultPrice.price';
if ($fallback->
getId() !=
$current->
getId()) { $priceField = 'IFNULL(customerPrice.price, defaultPrice.price)';
} $discount =
$current->
useDiscount() ?
$current->
getPercentageDiscount() : 0;
$considerMinPurchase =
$this->config->
get('calculateCheapestPriceWithMinPurchase'
);
$taxCase =
$this->
buildTaxCase($context);
// rounded to filter this value correctly
// => 2,99999999 displayed as 3,- € but won't be displayed with a filter on price >= 3,- €
return 'ROUND(' .
// customer group price (with fallback switch)
$priceField .
// multiplied with the variant min purchase
($considerMinPurchase ? ' * availableVariant.minpurchase' : ''
) .