$prices =
$this->
buildPrices($products,
$rules,
$group);
// check if one of the products have no assigned price within the prices variable.
$fallbackProducts =
array_filter( $products,
function DBaseProduct
$product) use ($prices) { return !\
array_key_exists($product->
getNumber(),
$prices);
} );
if (empty($fallbackProducts)) { return $this->
calculatePriceGroupDiscounts($products,
$prices,
$context);
} // if some product has no price, we have to load the fallback customer group prices for the fallbackProducts.
$fallbackPrices =
$this->cheapestPriceGateway->
getList( $fallbackProducts,
$context,
$context->
getFallbackCustomerGroup() );
$fallbackPrices =
$this->
buildPrices( $fallbackProducts,