当前位置: 首页>>代码示例>>PHP>>正文


PHP CSaleOrder::DoCalculateOrder方法代码示例

本文整理汇总了PHP中CSaleOrder::DoCalculateOrder方法的典型用法代码示例。如果您正苦于以下问题:PHP CSaleOrder::DoCalculateOrder方法的具体用法?PHP CSaleOrder::DoCalculateOrder怎么用?PHP CSaleOrder::DoCalculateOrder使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CSaleOrder的用法示例。


在下文中一共展示了CSaleOrder::DoCalculateOrder方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: array

			false,
			false,
			array("ID", "CITY_ID")
		);
		$arCity = $rsLocationsList->GetNext();
		if (intval($arCity["CITY_ID"]) <= 0)
			$bDeleteFieldLocation = "Y";
		else
			$bDeleteFieldLocation = "N";

		$arOrder = CSaleOrder::DoCalculateOrder(
			$LID,
			$user_id,
			$arShoppingCart,
			$buyerTypeId,
			$arOrderPropsValues,
			$deliveryId,
			$paySystemId,
			$arOrderOptions,
			$arErrors,
			$arWarnings
		);

		$orderDiscount = 0;
		$arData = array();
		$arFilterRecommended = array();
		$priceBaseTotal = 0;

		if (!empty($arOrder["BASKET_ITEMS"]))
		{
			$arCatalogProduct = array();
			foreach ($arOrder["BASKET_ITEMS"] as $val)
开发者ID:ASDAFF,项目名称:entask.ru,代码行数:32,代码来源:order_new.php

示例2: foreach

         }
         $arResult["ORDER_PROP"]["RELATED"] = $arRes;
     }
 }
 /* End of related order properties */
 /* New discount */
 foreach (GetModuleEvents("sale", "OnSaleComponentOrderOneStepDiscountBefore", true) as $arEvent) {
     ExecuteModuleEventEx($arEvent, array(&$arResult, &$arUserResult, &$arParams));
 }
 // use later only items not part of the sets
 foreach ($arResult["BASKET_ITEMS"] as $id => $arItem) {
     if (CSaleBasketHelper::isSetItem($arItem)) {
         unset($arResult["BASKET_ITEMS"][$id]);
     }
 }
 $arOrderDat = CSaleOrder::DoCalculateOrder(SITE_ID, $USER->GetID(), $arResult["BASKET_ITEMS"], $arUserResult['PERSON_TYPE_ID'], $arUserResult["ORDER_PROP"], $arUserResult["DELIVERY_ID"], $arUserResult["PAY_SYSTEM_ID"], array(), $arErrors, $arWarnings);
 if (empty($arOrderDat)) {
     $arResult['ERROR'][] = GetMessage('SOA_ORDER_CALCULATE_ERROR');
     if (!empty($arResult["BASKET_ITEMS"])) {
         foreach ($arResult["BASKET_ITEMS"] as $key => &$arItem) {
             $arItem["SUM"] = SaleFormatCurrency($arItem["PRICE"] * $arItem["QUANTITY"], $arResult["BASE_LANG_CURRENCY"]);
             // prepare values for custom-looking columns
             $arCols = array("PROPS" => getPropsInfo($arItem));
             if (isset($arItem["PREVIEW_PICTURE"]) && intval($arItem["PREVIEW_PICTURE"]) > 0) {
                 $arCols["PREVIEW_PICTURE"] = CSaleHelper::getFileInfo($arItem["PREVIEW_PICTURE"], array("WIDTH" => 110, "HEIGHT" => 110));
             }
             if (isset($arItem["DETAIL_PICTURE"]) && intval($arItem["DETAIL_PICTURE"]) > 0) {
                 $arCols["DETAIL_PICTURE"] = CSaleHelper::getFileInfo($arItem["DETAIL_PICTURE"], array("WIDTH" => 110, "HEIGHT" => 110));
             }
             if (isset($arItem["MEASURE_TEXT"]) && strlen($arItem["MEASURE_TEXT"]) > 0) {
                 $arCols["QUANTITY"] = $arItem["QUANTITY"] . "&nbsp;" . $arItem["MEASURE_TEXT"];
开发者ID:sharapudinov,项目名称:lovestore.top,代码行数:31,代码来源:component.php

示例3: array

         }
     }
 }
 $arBasketItems = CSaleOrder::DoCalculateOrder(SITE_ID, $currentUserId, $arShoppingCart, $PERSON_TYPE, $arPropValues, $DELIVERY_ID, $PAYSYSTEM_ID, array(), $arErrors, $arWarnings);
 if ((!empty($arErrors) || !empty($arWarnings)) && strlen($_REQUEST["AJAX_CALL"]) > 0 && !isset($_POST["BasketRefresh"])) {
     foreach ($arErrors as $val) {
         $errorMessage .= $val["TEXT"] . "<br>";
     }
     foreach ($arWarnings as $val) {
         $errorMessage .= $val["TEXT"] . "<br>";
     }
     $arErrors = array();
     $arWarnings = array();
     $DELIVERY_ID = "";
     $PAYSYSTEM_ID = "";
     $arBasketItems = CSaleOrder::DoCalculateOrder(SITE_ID, $currentUserId, $arShoppingCart, $PERSON_TYPE, $arPropValues, $DELIVERY_ID, $PAYSYSTEM_ID, array(), $arErrors, $arWarnings);
 }
 /*********************************************************/
 /*********************** SAVE ****************************/
 /*********************************************************/
 $ORDER_ID = "";
 if ($_SERVER["REQUEST_METHOD"] == "POST" && isset($_POST["BasketOrder"]) and strlen($errorMessage) <= 0 and check_bitrix_sessid()) {
     if (!empty($arWarnings)) {
         foreach ($arWarnings as $val) {
             $errorMessage .= $val["TEXT"] . "<br>";
         }
     }
     if (!empty($arErrors)) {
         foreach ($arErrors as $val) {
             $errorMessage .= $val["TEXT"] . "<br>";
         }
开发者ID:webgksupport,项目名称:alpina,代码行数:31,代码来源:component.php

示例4: saveOrder

 public function saveOrder()
 {
     $arErrors = $arWarnings = array();
     $user = $this->getUser();
     $arOrderDat = \CSaleOrder::DoCalculateOrder(SITE_ID, $user['ID'], $this->getItemsRaw(), 1, array(), $this->getDeliveryId(), $this->getPaymentId(), array(), $arErrors, $arWarnings);
     $data = array('LID' => SITE_ID, 'PERSON_TYPE_ID' => 1, 'PAYED' => 'N', 'CANCELED' => 'N', 'STATUS_ID' => 'N', 'PRICE' => $this->getTotalDelivery(), 'CURRENCY' => 'RUB', 'USER_ID' => $user['ID'], 'PAY_SYSTEM_ID' => $this->getPaymentId(), 'PRICE_DELIVERY' => $this->getDeliveryPrice(), 'DELIVERY_ID' => $this->getDeliveryId(), 'DISCOUNT_VALUE' => 0, 'TAX_VALUE' => 0.0);
     $arOrderDat['ORDER_PROP'][3] = $user['PERSONAL_PHONE'];
     $errors = array();
     $orderId = \CSaleOrder::DoSaveOrder($arOrderDat, $data, 0, $errors);
     return $orderId;
 }
开发者ID:ASDAFF,项目名称:bitrix_lib,代码行数:11,代码来源:Cart.class.php

示例5: processOrderAcceptRequest

 protected function processOrderAcceptRequest($arPostData)
 {
     $arResult = array();
     DiscountCompatibility::reInit(DiscountCompatibility::MODE_EXTERNAL, array('SITE_ID' => $this->siteId));
     if ($this->checkOrderAcceptStructure($arPostData)) {
         $dbRes = \Bitrix\Sale\TradingPlatform\OrderTable::getList(array("filter" => array("TRADING_PLATFORM_ID" => YandexMarket::getInstance()->getId(), "EXTERNAL_ORDER_ID" => $arPostData["order"]["id"])));
         if (!($orderCorrespondence = $dbRes->fetch())) {
             require_once $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/sale/general/admin_tool.php";
             $arProducts = array();
             foreach ($arPostData["order"]["items"] as $arItem) {
                 $arProduct = $this->getProductById($arItem["offerId"], $arItem["count"]);
                 $arProduct["PRODUCT_ID"] = $arItem["offerId"];
                 $arProduct["MODULE"] = "catalog";
                 $arProduct["PRODUCT_PROVIDER_CLASS"] = "CCatalogProductProvider";
                 $dbIblockElement = CIBlockElement::GetList(array(), array("ID" => $arItem["offerId"]), false, false, array('XML_ID', 'IBLOCK_EXTERNAL_ID'));
                 if ($IblockElement = $dbIblockElement->Fetch()) {
                     if (strlen($IblockElement["XML_ID"]) > 0) {
                         $arProduct["PRODUCT_XML_ID"] = $IblockElement["XML_ID"];
                     }
                     if (strlen($IblockElement["IBLOCK_EXTERNAL_ID"]) > 0) {
                         $arProduct["CATALOG_XML_ID"] = $IblockElement["IBLOCK_EXTERNAL_ID"];
                     }
                 }
                 if ($arProduct["CAN_BUY"] == "Y") {
                     $arProducts[] = $arProduct;
                 }
             }
             $arOrderProductPrice = fGetUserShoppingCart($arProducts, $this->siteId, "N");
             $arErrors = array();
             $userId = intval(CSaleUser::GetAnonymousUserID());
             $arShoppingCart = CSaleBasket::DoGetUserShoppingCart($this->siteId, $userId, $arOrderProductPrice, $arErrors);
             $deliveryId = $arPostData["order"]["delivery"]["id"];
             $paySystemId = $this->mapPaySystems[$arPostData["order"]["paymentMethod"]];
             $locationId = $this->locationMapper->getLocationByCityName($arPostData["order"]["delivery"]["region"]["name"]);
             if ($locationId === false) {
                 $this->log(self::LOG_LEVEL_INFO, "YMARKET_LOCATION_MAPPING", $arPostData["order"]["delivery"]["region"]["name"], GetMessage("SALE_YMH_LOCATION_NOT_FOUND"));
             }
             $arErrors = $arWarnings = array();
             $arOptions = array();
             $arOrderPropsValues = $this->makeAdditionalOrderProps($arPostData["order"]["delivery"]["address"], array(), $this->mapPaySystems[$arPostData["order"]["paymentMethod"]], $arPostData["order"]["delivery"]["id"], $locationId);
             $CSaleOrder = new CSaleOrder();
             $arOrder = $CSaleOrder->DoCalculateOrder($this->siteId, $userId, $arShoppingCart, $this->personTypeId, $arOrderPropsValues, $deliveryId, $paySystemId, $arOptions, $arErrors, $arWarnings);
             $arErrors = array();
             $arAdditionalFields = array("XML_ID" => self::XML_ID_PREFIX . $arPostData["order"]["id"]);
             $arOrder["LID"] = $this->siteId;
             if (isset($arPostData["order"]["notes"])) {
                 $arAdditionalFields["USER_DESCRIPTION"] = $arPostData["order"]["notes"];
             }
             $orderID = $CSaleOrder->DoSaveOrder($arOrder, $arAdditionalFields, 0, $arErrors);
             $res = \Bitrix\Sale\TradingPlatform\OrderTable::add(array("ORDER_ID" => $orderID, "TRADING_PLATFORM_ID" => YandexMarket::getInstance()->getId(), "EXTERNAL_ORDER_ID" => $arPostData["order"]["id"]));
             if (!$res->isSuccess()) {
                 foreach ($res->getErrors() as $error) {
                     $this->log(self::LOG_LEVEL_ERROR, "YMARKET_PLATFORM_ORDER_ADD_ERROR", $orderID, $error);
                 }
             }
         } else {
             $orderID = $orderCorrespondence["ORDER_ID"];
         }
         if (intval($orderID > 0)) {
             $arResult["order"]["accepted"] = true;
             $arResult["order"]["id"] = strval($orderID);
             $this->log(self::LOG_LEVEL_INFO, "YMARKET_ORDER_CREATE", $arPostData["order"]["id"], GetMessage("SALE_YMH_ORDER_CREATED") . " " . $orderID);
         } else {
             $arResult["order"]["accepted"] = false;
             $arResult["order"]["reason"] = "OUT_OF_DATE";
             $this->log(self::LOG_LEVEL_ERROR, "YMARKET_ORDER_CREATE", $arPostData["order"]["id"], print_r($arErrors, true));
         }
     } else {
         $arResult = $this->processError(self::ERROR_STATUS_400, GetMessage("SALE_YMH_ERROR_BAD_STRUCTURE"));
     }
     return $arResult;
 }
开发者ID:akniyev,项目名称:itprom_dobrohost,代码行数:72,代码来源:ym_handler.php

示例6: Add


//.........这里部分代码省略.........
         unset($key, $arItem);
         // </editor-fold>
         // person type
         $personTypeId = 0;
         if (!isset($arFields['PERSON_TYPE_ID']) || intval($arFields['PERSON_TYPE_ID']) <= 0) {
             $arPersonTypes = CCrmPaySystem::getPersonTypeIDs();
             if (isset($arPersonTypes['CONTACT'])) {
                 $personTypeId = intval($arPersonTypes['CONTACT']);
             }
         } else {
             $personTypeId = $arFields['PERSON_TYPE_ID'];
         }
         if ($personTypeId <= 0) {
             return false;
         }
         // preparing order to save
         // <editor-fold defaultstate="collapsed" desc="preparing order to save ...">
         $arOrderPropsValues = array();
         if (isset($arFields['INVOICE_PROPERTIES']) && is_array($arFields['INVOICE_PROPERTIES']) && count($arFields['INVOICE_PROPERTIES']) > 0) {
             $arOrderPropsValues = $arFields['INVOICE_PROPERTIES'];
         }
         if (isset($arFields['INVOICE_PROPERTIES'])) {
             unset($arFields['INVOICE_PROPERTIES']);
         }
         if (count($arOrderPropsValues) <= 0) {
             return false;
         }
         $deliveryId = null;
         $paySystemId = $arFields['PAY_SYSTEM_ID'];
         $arOptions = array('LOCATION_IN_CODES' => true);
         // let DoCalculateOrder know we send location in CODEs
         $arErrors = $arWarnings = array();
         $CSaleOrder = new CSaleOrder();
         $arOrder = $CSaleOrder->DoCalculateOrder($siteId, $saleUserId, $arShoppingCart, $personTypeId, $arOrderPropsValues, $deliveryId, $paySystemId, $arOptions, $arErrors, $arWarnings);
         if (count($arOrder) <= 0) {
             return false;
         }
         // </editor-fold>
         if ($bRecalculate) {
             foreach ($arOrder as $k => $v) {
                 $arRecalculated[$k] = $v;
             }
             return true;
         }
         // merge order fields
         $arAdditionalFields = array();
         foreach ($arFields as $k => $v) {
             if ($k === 'PRODUCT_ROWS') {
                 continue;
             }
             $arAdditionalFields[$k] = $v;
         }
         $arOrder['LOCATION_IN_CODES'] = true;
         // let DoSaveOrder know we send location in IDs
         // saving order
         $arErrors = array();
         $orderID = $CSaleOrder->DoSaveOrder($arOrder, $arAdditionalFields, $tmpOrderId, $arErrors);
         if (is_int($orderID) && $orderID > 0) {
             CCrmEntityHelper::NormalizeUserFields($arFields, self::$sUFEntityID, $GLOBALS['USER_FIELD_MANAGER'], array('IS_NEW' => $tmpOrderId === 0));
             $GLOBALS['USER_FIELD_MANAGER']->Update(self::$sUFEntityID, $orderID, $arFields);
         }
         if (is_int($orderID) && $orderID > 0 && isset($options['REGISTER_SONET_EVENT']) && $options['REGISTER_SONET_EVENT'] === true) {
             $prevResponsibleID = is_array($arPrevOrder) && isset($arPrevOrder['RESPONSIBLE_ID']) ? intval($arPrevOrder['RESPONSIBLE_ID']) : 0;
             $responsibleID = isset($arFields['RESPONSIBLE_ID']) ? intval($arFields['RESPONSIBLE_ID']) : 0;
             if ($tmpOrderId <= 0) {
                 self::RegisterLiveFeedEvent($arFields, $orderID, $userId);
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:67,代码来源:crm_invoice.php

示例7: Calculate

 public static function Calculate($productRows, $currencyID, $personTypeID, $enableSaleDiscount = false, $siteId = SITE_ID, $arOptions = array())
 {
     if (!CModule::IncludeModule('sale')) {
         return array('err' => '1');
     }
     $saleUserId = intval(CSaleUser::GetAnonymousUserID());
     if ($saleUserId <= 0) {
         return array('err' => '2');
     }
     if (!is_array($productRows) && empty($productRows)) {
         return array('err' => '3');
     }
     $bTaxMode = CCrmTax::isTaxMode();
     if ($bTaxMode) {
         foreach ($productRows as &$productRow) {
             $productRow['TAX_RATE'] = 0.0;
             $productRow['TAX_INCLUDED'] = 'N';
         }
         unset($productRow);
     }
     $cartItems = self::PrepareShoppingCartItems($productRows, $currencyID, $siteId);
     foreach ($cartItems as &$item) {
         $item['ID_TMP'] = $item['ID'];
         unset($item['ID']);
     }
     unset($item);
     $errors = array();
     $cartItems = CSaleBasket::DoGetUserShoppingCart($siteId, $saleUserId, $cartItems, $errors, array(), 0, true);
     foreach ($cartItems as &$item) {
         $item['ID'] = $item['ID_TMP'];
         unset($item['ID_TMP']);
     }
     unset($item);
     $personTypeID = intval($personTypeID);
     if ($personTypeID <= 0) {
         $personTypes = CCrmPaySystem::getPersonTypeIDs();
         if (isset($personTypes['CONTACT'])) {
             $personTypeID = intval($personTypes['CONTACT']);
         }
     }
     if ($personTypeID <= 0) {
         return array('err' => '4');
     }
     $orderPropsValues = array();
     $paySystemId = 0;
     if (is_array($arOptions) && !empty($arOptions)) {
         if (isset($arOptions['LOCATION_ID']) && CCrmTax::isTaxMode()) {
             $locationPropertyID = self::getLocationPropertyId($personTypeID);
             if ($locationPropertyID !== false) {
                 $orderPropsValues[$locationPropertyID] = $arOptions['LOCATION_ID'];
             }
         }
         if (isset($arOptions['PAY_SYSTEM_ID'])) {
             $paySystemId = intval($arOptions['PAY_SYSTEM_ID']);
         }
     }
     $warnings = array();
     $options = array('CURRENCY' => $currencyID);
     if (!$enableSaleDiscount) {
         $options['CART_FIX'] = 'Y';
     }
     return CSaleOrder::DoCalculateOrder($siteId, $saleUserId, $cartItems, $personTypeID, $orderPropsValues, 0, $paySystemId, $options, $errors, $warnings);
 }
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:63,代码来源:sale_helper.php

示例8: addOrder

/**
 * [addOrder функция добавления заказа]
 * @param array $arParams
 * @return array or false
 */
function addOrder($arParams)
{
    if (!CModule::IncludeModule('sale')) {
        return false;
    }
    global $USER;
    global $DB;
    $addCommentsOrder = false;
    $commentForManager = "";
    updateBasketPreOrder();
    // обновляем корзину
    $arBasketItems = array();
    $dbBasketItems = CSaleBasket::GetList(array("NAME" => "ASC", "ID" => "ASC"), array("FUSER_ID" => CSaleBasket::GetBasketUserID(), "LID" => SITE_ID, "ORDER_ID" => "NULL"), false, false, array("ID", "CALLBACK_FUNC", "MODULE", "PRODUCT_ID", "QUANTITY", "DELAY", "CAN_BUY", "PRICE", "WEIGHT", "NAME", "CURRENCY", "CATALOG_XML_ID", "VAT_RATE", "NOTES", "DISCOUNT_PRICE", "PRODUCT_PROVIDER_CLASS", "DIMENSIONS", "TYPE", "SET_PARENT_ID", "DETAIL_PAGE_URL"));
    while ($arItem = $dbBasketItems->Fetch()) {
        $arPropItem = getItemCart($arItem["PRODUCT_ID"]);
        $db_res = CSaleBasket::GetPropsList(array("SORT" => "ASC", "NAME" => "ASC"), array("BASKET_ID" => $arItem['ID']), false, array());
        while ($ar_res = $db_res->Fetch()) {
            if ($ar_res["CODE"] == "DEPOSIT" && $ar_res["VALUE"] == "N") {
                $addCommentsOrder = true;
            }
        }
        $arBasketItems[] = $arItem;
        $arItem["ARTIKUL"] = $arPropItem["PROPERTY_ARTIKUL_VALUE"];
        $strOrderList .= '<a href="http://' . $_SERVER["HTTP_HOST"] . $arItem["DETAIL_PAGE_URL"] . '">' . $arItem["ARTIKUL"] . '</a> ' . $arItem["NAME"] . ' - ' . $arItem["QUANTITY"] * 1 . ' шт. x ' . SaleFormatCurrency($arItem["PRICE"], $arItem["CURRENCY"]);
        $strOrderList .= "<br />";
        $allDiscountItems += $arItem["DISCOUNT_PRICE"];
    }
    if (!$arBasketItems) {
        return false;
    }
    $arOrderDat = CSaleOrder::DoCalculateOrder(SITE_ID, $USER->GetID(), $arBasketItems, 1, $arUserResult["ORDER_PROP"], $arParams["DELIVERY_ID"], $arParams["PAY_SYSTEM_ID"], array(), $arErrors, $arWarnings);
    $arOrderDat["ORDER_PROP"][20] = $arParams["ORDER_PROP_20"];
    $arOrderDat["ORDER_PROP"][7] = $arParams["ORDER_PROP_7"];
    $arOrderDat["ORDER_PROP"][3] = $arParams["ORDER_PROP_3"];
    //echo "<pre>";print_r($PRICE);echo "</pre>";die();
    //echo "<pre>";print_r($arOrderDat);echo "</pre>";die();
    //echo "<pre>";print_r($arParams);echo "</pre>";die();
    $arFields = array("LID" => SITE_ID, "PERSON_TYPE_ID" => 1, "PAYED" => "N", "CANCELED" => "N", "STATUS_ID" => "N", "PRICE" => $arOrderDat["ORDER_PRICE"], "CURRENCY" => $arOrderDat["CURRENCY"], "USER_ID" => IntVal($USER->GetID()), "PAY_SYSTEM_ID" => $arOrderDat["PAY_SYSTEM_ID"], "PRICE_DELIVERY" => $arOrderDat["PRICE_DELIVERY"], "DELIVERY_ID" => $arOrderDat["DELIVERY_ID"], "DISCOUNT_VALUE" => $arOrderDat["DISCOUNT_VALUE"], "TAX_VALUE" => $arOrderDat["TAX_VALUE"], "DELIVERY_LOCATION" => $arOrderDat["DELIVERY_LOCATION"], "USER_DESCRIPTION" => $arParams["ORDER_DESCRIPTION"], "COMMENTS" => $commentForManager);
    $ORDER_ID = (int) CSaleOrder::DoSaveOrder($arOrderDat, $arFields, 0, $arResult["ERROR"]);
    if ($ORDER_ID > 0) {
        $arOrder = getOrder($ORDER_ID);
        // для менеджера
        if ($addCommentsOrder === true && $arParams["PAY_SYSTEM_ID"] == 10) {
            // сообщение для менеджера
            $commentForManager .= 'Выбран способ оплаты PayKeeper, но в заказе есть товары "По запросу".';
            $commentForManager .= "\n";
            $commentForManager .= "Ссылка для оплаты: http://" . $_SERVER["HTTP_HOST"] . "/personal/order/payment/?ORDER_ID=" . $ORDER_ID;
            $arFields = array("COMMENTS" => $commentForManager);
            CSaleOrder::Update($ORDER_ID, $arFields);
        }
        // отправляем письмо
        $arFieldsEvent = array("ORDER_ID" => getNumberOrder($ORDER_ID), "ORDER_DATE" => Date($DB->DateFormatToPHP(CLang::GetDateFormat("SHORT", SITE_ID))), "ORDER_USER" => $USER->GetFormattedName(false), "PRICE" => SaleFormatCurrency($arOrderDat["ORDER_PRICE"], $arOrderDat["CURRENCY"]), "BCC" => COption::GetOptionString("sale", "order_email", "order@" . $SERVER_NAME), "EMAIL" => strlen($arUserResult["USER_EMAIL"]) > 0 ? $arUserResult["USER_EMAIL"] : $USER->GetEmail(), "ORDER_LIST" => $strOrderList, "SALE_EMAIL" => COption::GetOptionString("sale", "order_email", "order@" . $SERVER_NAME), "DISCOUNT" => $allDiscountItems . " руб.", "DELIVERY_PRICE" => "", "DELIVERY_TYPE" => getDeliveryName($arOrderDat["DELIVERY_ID"]), "ADDRESS" => strlen($arParams["ORDER_PROP_7"]) > 0 ? $arParams["ORDER_PROP_7"] : "Адрес не указан", "COMMENT" => strlen($arParams["ORDER_DESCRIPTION"]) > 0 ? $arParams["ORDER_DESCRIPTION"] : "Нет комментария");
        //Формируем писмо для отправки менеджеру
        switch ($arParams["PAY_SYSTEM_ID"]) {
            case 10:
                $price_method = 'Оплата банковской картой VISA, MASTERCARD, MAESTRO';
                break;
            case 8:
                $price_method = 'Безналичный расчет';
                break;
            case 1:
                $price_method = 'Наличными при получении';
                break;
        }
        $rsGroups = CGroup::GetList($by = "c_sort", $order = "asc", array("ID" => implode('|', $USER->GetUserGroupArray())));
        $groups = array();
        if (intval($rsGroups->SelectedRowsCount()) > 0) {
            while ($arGroups = $rsGroups->Fetch()) {
                if ((int) $arGroups['ID'] != 2 && (int) $arGroups['ID'] != 3 && (int) $arGroups['ID'] != 4) {
                    $groups[] = $arGroups['NAME'];
                }
            }
        }
        $arFieldsManager = array('NUMBER' => getNumberOrder($ORDER_ID), 'DATE' => Date($DB->DateFormatToPHP(CLang::GetDateFormat("SHORT", SITE_ID))), 'SELLER_TYPE' => implode(',', $groups), 'FIO' => $USER->GetFormattedName(false), 'PHONE' => strlen($arParams["ORDER_PROP_3"]) > 0 ? $arParams["ORDER_PROP_3"] : "Телефон не указан", 'EMAIL' => $USER->GetEmail(), 'ADRESS' => strlen($arParams["ORDER_PROP_7"]) > 0 ? $arParams["ORDER_PROP_7"] : "Адрес не указан", 'DOSTAVKA' => getDeliveryName($arOrderDat["DELIVERY_ID"]), 'PRICE_METHOD' => $price_method, 'ORDERS' => $strOrderList . '<br />Итого: ' . $arOrderDat["ORDER_PRICE"], 'DISCOUNT' => $allDiscountItems . " руб.", 'COMMENT' => strlen($arParams["ORDER_DESCRIPTION"]) > 0 ? $arParams["ORDER_DESCRIPTION"] : "Нет комментария");
        $eventName = "SALE_NEW_ORDER";
        $eventNameManager = "FORM_FILLING_NEW_ORDER";
        $bSend = true;
        foreach (GetModuleEvents("sale", "OnOrderNewSendEmail", true) as $arEvent) {
            if (ExecuteModuleEventEx($arEvent, array($arResult["ORDER_ID"], &$eventName, &$arFields)) === false) {
                $bSend = false;
            }
        }
        if ($bSend) {
            $event = new CEvent();
            $event->Send($eventName, SITE_ID, $arFieldsEvent, "N");
            $event->Send($eventNameManager, SITE_ID, $arFieldsManager, "N");
        }
        return $ORDER_ID;
    }
    return false;
}
开发者ID:akniyev,项目名称:arteva.ru,代码行数:96,代码来源:functions.php


注:本文中的CSaleOrder::DoCalculateOrder方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。