// start first cart calculation to have all objects enriched
$cart =
$this->processor->
process($cart,
$context,
$behaviorContext);
do { $compare =
$cart;
if ($iteration > self::MAX_ITERATION
) { break;
} // filter rules which matches to current scope
$rules =
$rules->
filterMatchingRules($cart,
$context);
// update matching rules in context
$context->
setRuleIds($rules->
getIds());
// calculate cart again
$cart =
$this->processor->
process($cart,
$context,
$behaviorContext);
// check if the cart changed, in this case we have to recalculate the cart again
$recalculate =
$this->
cartChanged($cart,
$compare);
// check if rules changed for the last calculated cart, in this case we have to recalculate