Answer the question
In order to leave comments, you need to log in
How to remove the error "Maximum function nesting level of '256' reached, aborting!"?
At the "Save order" event, I try to change the status of the order, I write the code:
$order = $event->getParameter("ENTITY");
$order->setField("STATUS_ID", "T");
$order->save();
Answer the question
In order to leave comments, you need to log in
You are entering an endless cycle of updates. At the entrance to the function, check that the desired status is already set.
No need to call $order->save();
public function changeStatusOnOrderCreate(\Bitrix\Main\Event $event)
{
/** @var \Bitrix\Sale\Order $order */
$order = $event->getParameter("ENTITY");
$order->setField("STATUS_ID", "T");
$event->addResult(
new Main\EventResult(
Main\EventResult::SUCCESS, $order
)
);
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question