Created
August 12, 2016 06:11
-
-
Save VSeryoga/826171f12813e7c3d6a0f3d3d384449d to your computer and use it in GitHub Desktop.
Send order bitrix (filds)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<? | |
//Дополнительные поля к уведомлению о заказе | |
AddEventHandler("main", "OnBeforeEventAdd", "OnSaleDeliveryOrderSendEmail"); | |
function OnSaleDeliveryOrderSendEmail (&$event, &$lid, &$arFields, &$message_id) { | |
if ($event=="SALE_NEW_ORDER") { | |
if ($arFields['ORDER_ID']>0) { | |
$order = CSaleOrder::GetByID($arFields['ORDER_ID']); | |
$arFields['COMMENT'] = $order["USER_DESCRIPTION"]; | |
$db_props = CSaleOrderPropsValue::GetOrderProps($arFields['ORDER_ID']); | |
while ($arProps = $db_props->Fetch()){ | |
if($arProps["CODE"] == "EMAIL"){ | |
$arFields['USER_EMAIL'] = $arProps["VALUE"]; | |
} | |
if($arProps["CODE"] == "PHONE"){ | |
$arFields['PHONE'] = $arProps["VALUE"]; | |
} | |
if($arProps["CODE"] == "FIO"){ | |
$arFields['NAME'] = $arProps["VALUE"]; | |
} | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment