Y
Y
Yuri Shchegolikhin2018-07-14 13:47:38
1C-Bitrix
Yuri Shchegolikhin, 2018-07-14 13:47:38

Bitrix mail template not working?

How to add #ORDER_USER# for other order statuses?
It doesn't work except order item Accepted

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexey Burlaka, 2018-07-14
@AlexeyGfi

Here are the keys provided in the system for the status change mail event:

$arFields = Array(
  "ORDER_ID" => (...),
  "ORDER_DATE" => (...),
  "ORDER_STATUS" => (...),
  "EMAIL" => (...),
  "ORDER_DESCRIPTION" => (...),
  "TEXT" => "",
  "SALE_EMAIL" => (...)
);

Among them, there is no data on the user, respectively, to do it directly (by setting the #ORDER_USER# key in the templates of mail types ) will not work.
However, when sending an email notification directly about a status change, among others , the
OnOrderStatusSendEmail event is fired , to which fields are passed as one of the parameters - a pointer to $arFields:
foreach(GetModuleEvents("sale", "OnOrderStatusSendEmail", true) as $arEvent)
  if (ExecuteModuleEventEx($arEvent, Array($ID, &$eventName, &$arFields, $arOrder["STATUS_ID"]))===false)
    $bSend = false;

You can subscribe to this event and, for example, do the following:
1. Add the #ORDER_USER#
key to the status mail template 2. When reacting to the event, form the required value for #ORDER_USER# and add it to it $arFields
Either, when intercepting the event, send your own version of the mail type from the function -reactions return false and then only the letter generated by you will leave the user.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question