Так я с этого и начала: запустила поиск по файлам. Нашла три файла, где упоминается OnOrderNewSendEmail, но ни в одном нет AddEventHandler.
Что это за компонент - я сама понять не могу (гуглила, не нашла даже слова такого). На самом деле это просто папка /bitrix/components/poltor/order/ с файлом component.php и файлом template.php. И написано в component.php вот что:
<?php
$arResult = array();
CModule::IncludeModule('sale');
$resBasketItems = CSaleBasket::GetList(
array(),
array(
'FUSER_ID' => CSaleBasket::GetBasketUserID(),
'LID' => SITE_ID,
'ORDER_ID' => null
),
false,
false,
array()
);
$arResult['ITEMS'] = array();
$basketPrice = 0;
while ($basketItem = $resBasketItems->Fetch()) {
$arResult['ITEMS'][] = $basketItem;
$basketPrice = $basketPrice + (int) ($basketItem['QUANTITY'] * $basketItem['PRICE'] ;) ;
}
if (count($arResult['ITEMS'] ;) == 0) {
LocalRedirect($arParams['BASKET_LINK'] ;) ;
}
if ($_REQUEST['ORDERFORM'] != 'Y'):
# Статичная форма
$arResult['PROPERTY_GROUPS'] = array();
$resOrderPropGroup = CSaleOrderPropsGroup::GetList(
array('SORT' => 'ASC'),
array('ACTIVE' => 'Y'),
false,
false,
array()
);
while ($orderPropGroup = $resOrderPropGroup->Fetch()) {
$orderPropGroup['PROPS'] = array();
$arResult['PROPERTY_GROUPS'][] = $orderPropGroup;
}
foreach ($arResult['PROPERTY_GROUPS'] as $i => $orderPropGroup) {
$resOrderProps = CSaleOrderProps::GetList(
array('SORT' => 'ASC'),
array('ACTIVE' => 'Y', 'PROPS_GROUP_ID' => $orderPropGroup['ID'] ;) ,
false,
false,
array()
);
while ($orderProp = $resOrderProps->Fetch()) {
$arResult['PROPERTY_GROUPS'][$i]['PROPS'][] = $orderProp;
}
}
$arResult['DELIVERY'] = CSaleDelivery::GetByID(1);
$this->IncludeComponentTemplate();
else:
# Ajax-обработчик
$resDelivery = CSaleDelivery::GetByID($_REQUEST['DELIVERY'] ;) ;
$deliveryPrice = $resDelivery['PRICE'];
$arResult = array();
if (!empty($_REQUEST['STEP'] ;) && $_REQUEST['STEP'] == 'confirm') {
$arFields = array(
'LID' => SITE_ID,
'PERSON_TYPE_ID' => 1,
'PAYED' => 'N',
'CANCELED' => 'N',
'STATUS_ID' => 'N',
'PRICE' => ($basketPrice + $deliveryPrice),
'CURRENCY' => 'RUB',
'USER_ID' => '2',
'PAY_SYSTEM_ID' => '1',
'PRICE_DELIVERY' => $deliveryPrice,
'DELIVERY_ID' => $_REQUEST['DELIVERY'],
'DISCOUNT_VALUE' => 0.0,
'TAX_VALUE' => 0.0,
'USER_DESCRIPTION' => $_REQUEST['COMMENT']
);
$orderId = CSaleOrder::Add($arFields);
if ($orderId) {
$arResult['STATUS'] = 'success';
CSaleBasket: :o rderBasket((int) $orderId, $_SESSION["SALE_USER_ID"], SITE_ID);
$props = array_merge($_REQUEST['PROPS'][1], $_REQUEST['PROPS'][2] ;) ;
$arFields = array(
"ORDER_ID" => $orderId,
"ORDER_PROPS_ID" => 1,
"NAME" => "ФИО",
"CODE" => "NAME",
"VALUE" => $props['NAME']
;) ;
CSaleOrderPropsValue::Add($arFields);
$arFields = array(
"ORDER_ID" => $orderId,
"ORDER_PROPS_ID" => 2,
"NAME" => "Email",
"CODE" => "EMAIL",
"VALUE" => $props['EMAIL']
;) ;
CSaleOrderPropsValue::Add($arFields);
$arFields = array(
"ORDER_ID" => $orderId,
"ORDER_PROPS_ID" => 3,
"NAME" => "Телефон",
"CODE" => "PHONE",
"VALUE" => $props['PHONE']
;) ;
CSaleOrderPropsValue::Add($arFields);
$arFields = array(
"ORDER_ID" => $orderId,
"ORDER_PROPS_ID" => 4,
"NAME" => "Адрес",
"CODE" => "ADDRESS",
"VALUE" => $props['ADDRESS']
;) ;
CSaleOrderPropsValue::Add($arFields);
$arFields = array(
"ORDER_ID" => $orderId,
"ORDER_PROPS_ID" => 5,
"NAME" => "Комментарий",
"CODE" => "COMMENT",
"VALUE" => $props['COMMENT']
;) ;
CSaleOrderPropsValue::Add($arFields);
$mailer = new Mailer();
$mailer->setEmailTo($props['EMAIL'] ;) ;
$mailer->setTitle('Вы сделали заказ на сайте LuxFlash');
ob_start();
include $_SERVER['DOCUMENT_ROOT'] . '/bitrix/templates/luxflash/mail/order.php';
$message = ob_get_contents();
ob_end_clean();
$mailer->setMessage($message);
$mailer->send();
$mailer = new Mailer();
$mailer->setEmailTo(COption::GetOptionString('main', 'email_from'));
$mailer->setTitle('Новый заказ на сайте Luxflash');
$mailer->setMessage('Заказ №' . $orderId);
$mailer->send();
$arResult['ORDER_ID'] = $orderId;
} else {
$arResult['STATUS'] = 'fail';
}
ob_end_clean();
echo json_encode($arResult);
die();
}
if (!empty($_REQUEST['STEP'] ;) && (int) $_REQUEST['STEP'] > 0) {
$resOrderProps = CSaleOrderProps::GetList(
array(),
array('ACTIVE' => 'Y', 'PROPS_GROUP_ID' => (int) $_REQUEST['STEP'] ;) ,
false,
false,
array()
);
$orderProps = array();
while ($orderProp = $resOrderProps->Fetch()) {
$orderProps[$orderProp['CODE']] = $orderProp;
}
if (count($orderProps) == 0) {
$arResult['STATUS'] = 'fail';
} else {
$step = (int) $_REQUEST['STEP'];
foreach ($_REQUEST['PROPS'][$step] as $code => $value) {
$propOptions = $orderProps[$code];
$checkTypeList = array();
if ($propOptions['REQUIED'] == 'Y') {
$checkTypeList[] = 'notEmpty';
}
if ($propOptions['IS_EMAIL'] == 'Y') {
$checkTypeList[] = 'email';
}
if ($code == 'PHONE') {
$checkTypeList[] = 'phone';
}
if (Validator::check($value, $checkTypeList)) {
$arResult['VALID'][] = $code;
} else {
$arResult['ERROR'][$code] = Validator::getLastError();
}
}
}
if (count($arResult['ERROR'] ;) == 0) {
$arResult['STATUS'] = 'success';
} else {
$arResult['STATUS'] = 'fail';
}
if (!empty($_REQUEST['DELIVERY'] ;) ) {
$resDelivery = CSaleDelivery::GetByID($_REQUEST['DELIVERY'] ;) ;
$arResult['DELIVERY_PRICE'] = (int) $resDelivery['PRICE'];
}
}
ob_end_clean();
echo json_encode($arResult);
die();
endif;
?>
а в template.php - вывод формы заказа на страницу.