// 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
$ruleCompare =
$all->
filterMatchingRules($cart,
$context);
if (!
$rules->
equals($ruleCompare)) { $recalculate = true;
$rules =
$ruleCompare;
} ++
$iteration;
} while ($recalculate);