Answer the question
In order to leave comments, you need to log in
For which emails can the #SALE_EMAIL# variable be used in Bitrix?
Bitrix has standard variables #DEFAULT_EMAIL_FROM# and #SALE_EMAIL#, will the latter work in all event templates and types?
And is it possible to add your own variables (for example, define them in the init.php file)?
Answer the question
In order to leave comments, you need to log in
When adding a mail template in the edit form, a list of available fields in the template is indicated at the bottom of the input field.
And while #DEFAULT_EMAIL_FROM# is available in almost all templates, #SALE_EMAIL# is available only in sale module templates.
You can use your variables by hanging on the OnBeforeEventSend event
Bitrix\Main\EventManager::getInstance()->addEventHandler(
'main',
'OnBeforeEventSend',
['TemplateModifier', 'onBeforeEventSend']
);
class TemplateModifier {
function onBeforeEventSend(&$fields, &$templateData)
{
$message = $templateData["MESSAGE"];
if(strpos($message,'#CUSTOM_VARIABLE#') !== false)
{
$fields['CUSTOM_VARIABLE'] = "значение своей переменной";
}
}
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question