S
S
sera1t2022-02-16 10:07:38
1C-Bitrix
sera1t, 2022-02-16 10:07:38

Do you need to create a cms bitrix module and make it react to the OnSaleOrderBeforeSaved event?

Hello, I’m trying to make such a problem so that the Bitrix module would work for me on the OnSaleBeforeOrder event. I created the module, connected all the connections went fine, I register the event in the install/index.php file in InstallEvent, through the EventManager::getInstance()->registerEventHandler command, but for some reason nothing works, I just want to intercept the order at the time of registration and change some data. Here's what should happen after the event is caught.

define("LOG_FILENAME", $_SERVER["DOCUMENT_ROOT"]."/log.txt");
        /** @var Order $order */
        $order = $event->getParameter("ENTITY");
        $order->setField('COMMENTS', 'New comments');
        $event->addResult(
            new Main\EventResult(
                Main\EventResult::SUCCESS, $order
            )
        );

It's just that New comments should be added to the DB in the comment column.
I have already searched the entire Internet, I have gone around everywhere they write the same thing and it works for everyone, but for some reason I don’t have what to do?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexander Zemlyanoy, 2022-02-16
@Galamoon

Most likely an error in registering an event from a banal typo to mixed up relationships. Check what your event subscription looks like in the b_module_to_module table

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question