$priceGroups =
$context->
getPriceGroups();
/*
* If one of the products has a configured price group,
* the graduated prices has to be build over the defined price group graduations.
*
* The price group discounts are defined with a percentage discount, which calculated
* on the first graduated price of the product.
*/
foreach ($products as $product) { if (!
$product->
isPriceGroupActive() || !
$product->
getPriceGroup()) { continue;
} if (!
isset($prices[$product->
getNumber()])) { continue;
} $priceGroupId =
$product->
getPriceGroup()->
getId();
if (!
isset($priceGroups[$priceGroupId])) { continue;
}