Exemple #1
0
     $arResult["ERROR_MESSAGE"]["NAME"] = GetMessage("STALL_USER_NAME_ERROR_MIN_VALUE");
 }
 if (strlen($_POST["email"]) < 5 || !check_email($_POST["email"])) {
     $arResult["ERROR_MESSAGE"]["EMAIL"] = GetMessage("STALL_USER_EMAIL_ERROR");
 }
 if (strlen($_POST["phone"]) < 5) {
     $arResult["ERROR_MESSAGE"]["PHONE"] = GetMessage("STALL_USER_PHONE_ERROR_MIN_VALUE");
 }
 if (empty($arResult["ERROR_MESSAGE"])) {
     $arFields = array("DATE_CREATE" => new \Bitrix\Main\Type\DateTime(null, 0), "FIO" => $_POST["name"], "PHONE" => $_POST["phone"], "COMMENT" => $_POST["msg"]);
     $order = ST\OrderTable::add($arFields);
     $ID = $order->getId();
     if ($ID) {
         while ($ob = $res->GetNext()) {
             $arFields = array('ORDER_ID' => $ID, 'ELEMENT_ID' => $cart->viewCart($ob['ID']), 'ELEMENT_NAME' => $ob['NAME'], 'PRICE' => $ob['PROPERTY_PRICE_VALUE'], 'COUNT' => $cart->viewCart($ob['ID'])['count']);
             $orderElem = ST\OrderElementTable::add($arFields);
         }
         $arResult["STATUS_BD"] = $ID;
         $arFields = array("MANAGER_EMAIL" => $arParams["ADMIN_EMAIL"], "USER_NAME" => $_POST["name"], "USER_EMAIL" => $_POST["email"], "USER_PHONE" => $_POST["phone"], "USER_MSG" => $_POST["msg"], "ORDER_NUMBER" => $arResult["STATUS_BD"], "ORDER_DATE" => date('d.m.Y'), "ORDER_LIST" => "Список позиций");
         if (!empty($arParams["EVENT_MESSAGE_ID"])) {
             foreach ($arParams["EVENT_MESSAGE_ID"] as $v) {
                 if (IntVal($v) > 0) {
                     CEvent::Send($arParams["EVENT_NAME"], SITE_ID, $arFields, "N", IntVal($v));
                 }
             }
         }
         if ($arParams["SEND_USER_EMAIL"] == "Y") {
             $arFieldsUser = array("AUTHOR" => $_POST["name"], "ORDER_DATE" => date('d.m.Y'), "ORDER_NUMBER" => $arResult["STATUS_BD"], "EMAIL" => $_POST["email"], "ORDER_LIST" => "Список позиций");
             if (!empty($arParams["EVENT_MESSAGE_USER_ID"])) {
                 foreach ($arParams["EVENT_MESSAGE_USER_ID"] as $v) {
                     if (IntVal($v) > 0) {
Exemple #2
0
        $errors = $res->getErrorMessages();
        $bVarsFromForm = true;
    }
}
// ******************************************************************** //
//                ВЫБОРКА И ПОДГОТОВКА ДАННЫХ ФОРМЫ                     //
// ******************************************************************** //
// значения по умолчанию
//$row['DATE_CREATE']       = '2015-12-21 00:00:00';
$arElement = array();
// выборка данных
if ($ID > 0) {
    $res = ST\OrderTable::getById($ID);
    $row = $res->fetch();
    if ($row) {
        $arElement = ST\OrderElementTable::getList(array('filter' => array('=ORDER_ID' => $ID)))->fetchAll();
        //Список элементов в заказе
    } else {
        $ID = 0;
    }
}
$arOrderStatus = ST\OrderStatusTable::getList(array('select' => array('ID', 'NAME'), 'order' => 'SORT'))->fetchAll();
//Список статусов
// если данные переданы из формы, инициализируем их
if ($bVarsFromForm) {
    //$DB->InitTableVarsForEdit($sTableID, "", "str_");
    $fields = $DB->GetTableFieldsList($sTableID);
    foreach ($fields as $strColumnName => $field) {
        if (isset(${$field})) {
            $row[$field] = ${$field};
        }
Exemple #3
0
        while ($row = $rsData->fetch())
        {
            $arID[] = $row['ID'];
        }
    }

    $resElem = ST\OrderElementTable::getList(array(
        'select' => array('ID'),
        'filter' => array('ORDER_ID' => $arID),
    ))->fetchAll();

    foreach($resElem as $arElem)
    {
        $ID = IntVal($arElem['ID']);
        if(strlen($ID) > 0)
            ST\OrderElementTable::delete($ID);
    }


    foreach($arID as $ID)
    {
        $ID = IntVal($ID);
        if(strlen($ID) > 0)
            ST\OrderTable::delete($ID);
    }
}

//Select elements
$rsStatus = ST\OrderTable::getList(
    array(
        'select' => array('*', 'STATUS_NAME' => 'STATUS.NAME'),