Нужно добавить в init.php
<?
AddEventHandler("main", "OnBeforeEventAdd", array("MailPost", "OnBeforeEventAddHandler"));
class MailPost
{
function OnBeforeEventAddHandler(&$event, &$lid, &$arFields)
{
if ($event=="SALE_NEW_ORDER") {
$order = CSaleOrder::GetByID($arFields['ORDER_ID']);
if(CModule::IncludeModule('sale')) {
if ($arOrder = CSaleOrder::GetByID($arFields['ORDER_ID'])) {
if ($arPaySys = CSalePaySystem::GetByID($arOrder["PAY_SYSTEM_ID"]))
{
if ($arPaySys["ID"] == "5") {
$arFields["REKVIZIT_SBERBANK"] = "<br>Номер карты сбербанка 4276720010044925 <br>Ирина Александровна С <br>В комментарии к оплате укажите вашу фамилию.";
}
$arFields["PAY_SYSTEM_ID"] = $arPaySys["NAME"];
}
if ($arDeliv = CSaleDelivery::GetByID($arOrder["DELIVERY_ID"]))
{
$arFields["DELIVERY_ID"] = $arDeliv["NAME"];
}
if ($arOrder["DELIVERY_ID"] == "pickpoint:postamat") {
$arFields["DELIVERY_ID"] = "Pickpoint";
}
}
if ($arOrderPropsValue = CSaleOrderPropsValue::GetOrderProps($arFields['ORDER_ID'])) {
while ($orderProp = $arOrderPropsValue->Fetch()) {
$orderProp["ORDER_PROPS_ID"] = intval($orderProp["ORDER_PROPS_ID"]);
switch ($orderProp["ORDER_PROPS_ID"]) {
case 1:
$arFields["FIO"] = $orderProp["VALUE"];
break;
case 9:
$arFields["LASTNAME"] = $orderProp["VALUE"];
break;
case 10:
$arFields["FIRSTNAME"] = $orderProp["VALUE"];
break;
case 11:
$arFields["SECONDNAME"] = $orderProp["VALUE"];
break;
case 3:
$arFields["PHONE"] = $orderProp["VALUE"];
break;
case 8:
$arFields["INDEX"] = $orderProp["VALUE"];
break;
case 5:
$arLocs = CSaleLocation::GetByID($orderProp["VALUE"], LANGUAGE_ID);
$arFields["LOCATION"] = $arLocs["COUNTRY_NAME"].' / '.$arLocs["REGION_NAME"].' / '.$arLocs["CITY_NAME_ORIG"];
break;
case 7:
$arFields["ADDRESS"] = $orderProp["VALUE"];
break;
}
$arFields["FIO"] = $arFields["LASTNAME"]." ".$arFields["FIRSTNAME"]." ".$arFields["SECONDNAME"];
}
}
}
}
}
}
?>