$eventManager = \Bitrix\Main\EventManager::getInstance();
$eventManager->addEventHandler('sender', 'OnBeforePostingSendRecipient', ['SenderEvents', 'OnBeforePostingSendRecipient']);
class SenderEvents {
public static function OnBeforePostingSendRecipient($event) {
$parameters = $event->getParameters();
file_put_contents($_SERVER["DOCUMENT_ROOT"].'/upload/log/sender.txt', json_encode($parameters)."\n", FILE_APPEND | LOCK_EX);
return new \Bitrix\Main\EventResult(\Bitrix\Main\EventResult::SUCCESS, $parameters);
}
}
[{"FIELDS":{"EMAIL_TO":"test@site.ru","NAME":"test","USER_ID":"1","SENDER_CHAIN_ID":2,"SENDER_CHAIN_CODE":"sender_chain_item_2"},"TRACK_READ":{"MODULE_ID":"sender","FIELDS":{"RECIPIENT_ID":"68"},"URL_PAGE":"","URL_PARAMS":[]},"TRACK_CLICK":{"MODULE_ID":"sender","FIELDS":{"RECIPIENT_ID":"68"},"URL_PAGE":"","URL_PARAMS":{"bx_sender_conversion_id":"68"}},"MAILING_CHAIN_ID":"3","LINK_DOMAIN":"site.ru"}]
[{"FIELDS":{"EMAIL_TO":"test2@mail.ru","NAME":"test2","USER_ID":"726","SENDER_CHAIN_ID":2,"SENDER_CHAIN_CODE":"sender_chain_item_2"},"TRACK_READ":{"MODULE_ID":"sender","FIELDS":{"RECIPIENT_ID":"69"},"URL_PAGE":"","URL_PARAMS":{"bx_sender_conversion_id":"68"}},"TRACK_CLICK":{"MODULE_ID":"sender","FIELDS":{"RECIPIENT_ID":"69"},"URL_PAGE":"","URL_PARAMS":{"bx_sender_conversion_id":"69"}},"MAILING_CHAIN_ID":"3","LINK_DOMAIN":"site.ru"}]
<Товар>
<Ид>Ц0000027053</Ид>
<БазоваяЕдиница Код="796" НаименованиеПолное="Штука" МеждународноеСокращение="PCE">шт</БазоваяЕдиница>
<Единица>
<Ид>796</Ид>
<НаименованиеКраткое>шт</НаименованиеКраткое>
<Код>796</Код>
<НаименованиеПолное>Штука</НаименованиеПолное>
</Единица>
$arLoadProductArray = Array(
"MODIFIED_BY" => 3,
"NAME" => $arData['PRODUCT_NAME'],
"ACTIVE" => "Y",
'TIMESTAMP_X'=>date('Y-m-d H:i:s'),
"IPROPERTY_TEMPLATES"=>Array(
"ELEMENT_PAGE_TITLE" => $arData['PRODUCT_NAME'],
"ELEMENT_META_TITLE" => $arData['PRODUCT_NAME'],
"SECTION_PAGE_TITLE" => $arData['PRODUCT_NAME'],
)
);
$el = new CIBlockElement;
$arLoadProductArray = Array(
"MODIFIED_BY" => 3, // элемент изменен текущим пользователем
"NAME" => $arData['PRODUCT_NAME'],
"ACTIVE" => "Y", // активен
);
$PRODUCT_ID = $arData['PRODUCT_ID']; // изменяем элемент с кодом (ID) 2
$res = $el->Update($PRODUCT_ID, $arLoadProductArray);
$el->Update($arItem['PRODUCT_ID'],['TIMESTAMP_X'=>date('d.m.Y H:i:s'),'NAME'=>$arItem['PRODUCT_NAME'],'ACTIVE'=>'Y','MODIFIED_BY'=>3]);
public static function UpdateProduct($arItem){
$el = new CIBlockElement;
$el->Update($arItem['PRODUCT_ID'],['TIMESTAMP_X'=>date('d.m.Y H:i:s'),'NAME'=>$arItem['PRODUCT_NAME'],'ACTIVE'=>'Y','MODIFIED_BY'=>3]);
}
что-то не вкурю никак, почему вот так не получить значения? возвращает NULL
$data = $event->getParameter("fields");