M
M
Maxim E2015-12-01 13:28:20
1C-Bitrix
Maxim E, 2015-12-01 13:28:20

How to get message fields or text in OnBeforeEventAdd?

When sending all emails, I hook my action:

AddEventHandler('main', 'OnBeforeEventAdd', Array("boomclass", "my_OnBeforeEventSend"));
class boomclass
{
    function my_OnBeforeEventSend($arFields)
    {
        $myfield = $arFields; // это будет свойство заказа
        // Дальше выполняем код PHP, который требуется?
        $mess = 'TEST - ';
                 foreach($myfield as $key => $value){
                 $mess .= $key.':'.$value.';';
                 }
                 $mess .= 'TEST2';
        mail("[email protected]", "TEST bitrix", $mess, $headers); // для примера, но будет другой код
    }
}

The result is a letter:
TEST-TEST2

You need to get the text of the letter or fields from the template.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Vladislav Kopylov, 2015-12-01
@creativeworm

Look at the input parameters in the documentation:
https://dev.1c-bitrix.ru/api_help/main/events/onbe...
arFields is the third one

function OnBeforeEventAddHandler(&$event, &$lid, &$arFields){}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question