A
A
Alexer052021-05-28 07:56:30
1C-Bitrix
Alexer05, 2021-05-28 07:56:30

How to add your entry to the history of order changes?

How to add your entry to the history of order changes? An example in the picture below

60b077dcecba6565716914.png

Answer the question

In order to leave comments, you need to log in

1 answer(s)
T
tgarl, 2021-05-28
@tgarl

Finding examples on the net is not so difficult, but not all examples are clear
. Here is my piece of code that I used

//https://doc.budagov.ru/class_bitrix_1_1_sale_1_1_order_history.html
$order_resave = \Bitrix\Sale\Order::load($orderID);
$historyEntityType = 'ORDER'; //Наименование - В данном случае для заказа
$historyType = 'ORDER_COMMENTED'; //Нужный тип можно посмотреть в классе \CSaleOrderChangeFormat в $operationTypes
                                    \Bitrix\Sale\OrderHistory::addAction(
                                        $historyEntityType,
                                        $order_resave->getId(),
                                        $historyType,
                                        $order_resave->getId(),
                                        $order_resave,
                                        ['COMMENTS' => 'Первый пересчет заказа - component.php']
                                    );

there is also addLog(), but I didn’t understand what the fundamental difference is

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question