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


PHP CSaleOrder::Add方法代码示例

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


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

示例1: bxModifySaleMails


//.........这里部分代码省略.........
                            
                $delivery_sum = null;
                $arSelect2 = Array("ID", "IBLOCK_ID", "NAME","PROPERTY_*");
                $arFilter2 = Array("IBLOCK_ID"=>9, "ACTIVE"=>"Y","ID"=>$id_partner,);
                $res2 = CIBlockElement::GetList(Array(), $arFilter2, false, false, $arSelect2);
                /**
                 * eсли в выборке корзине в продуктах больше чем один партнер
                 * то разбиваем заказ по количеству партнеров
                 */
                if (intval($res2->SelectedRowsCount())>0){
                    while($ob2 = $res2->GetNextElement()){
                        $arFields_partners = $ob2->GetFields();
                        $arProperties_partners = $ob2->GetProperties();
                        //_debug($arProperties_partners);
                        //$price_product=0;
                        //$products_descriptions="";
                        $arEventFields=array();
                        //echo $arFields_partners['ID'];
                        
                        
                        if($partner_product[$arFields_partners['ID']]){

                            $i=0;
                            $size_of_productpartner=sizeof($partner_product[$arFields_partners['ID']]);
                            foreach($partner_product[$arFields_partners['ID']] as $key_price=>$item_price){
                                //_debug($item_price);
                                $quantity=1;
                                /**
                                 * формируем новый пустой заказ
                                 */
                                if(!$i){


                                    if (!$ORDER_ID = CSaleOrder::Add(array(
                                        "LID"              => SITE_ID,
                                        "PERSON_TYPE_ID"   => 1,
                                        "PAYED"            => "N",
                                        "CANCELED"         => "N",
                                        "STATUS_ID"        => "N",
                                        "PRICE"            => 0,
                                        "CURRENCY"         => CSaleLang::GetLangCurrency(SITE_ID),
                                        "USER_ID"          => $arUser['ID'],
                                        "PAY_SYSTEM_ID"    => $arFieldsorder_old['PAY_SYSTEM_ID'],
                                        "PRICE_DELIVERY"   => 0,
                                        "DELIVERY_ID"      => $arFieldsorder_old['DELIVERY_ID'],
                                        "DISCOUNT_VALUE"   => $arFieldsorder_old['DISCOUNT_VALUE'],
                                        "TAX_VALUE"        => $arFieldsorder_old['TAX_VALUE'],
                                        "USER_DESCRIPTION" => $post['INFO']
                                    ))){

                                        $rows['msg'] = 'Ошибка создания заказа';
                                        $fail          = true;
                                    }else{
                                        $rows['msg']=$ORDER_ID;
                                        //continue;
                                    }
                                }

                                /**
                                 * добавляем по id заказа в корзину товары партнера
                                 */
                                if (!Add2BasketByProductID($item_price['PRODUCT_ID'], $item_price['QUANTITY'], array(
                                    'ORDER_ID' => $ORDER_ID,
                                ), $basket_props)) {
                                    $rows['err'] = 'Ошибка добавления товара в заказ';
                                    $fail          = true;
开发者ID:ASDAFF,项目名称:gpbitrix,代码行数:67,代码来源:class.php

示例2: array

 if ($arResult['ERROR'] == '') {
     $dbBaket = CSaleBasket::GetList(array(), array('FUSER_ID' => CSaleBasket::GetBasketUserID(), 'LID' => SITE_ID, 'ORDER_ID' => 'NULL'));
     while ($arBasket = $dbBaket->GetNext()) {
         if ($arBasket['CATALOG_XML_ID'] != '' && strpos($arBasket['CATALOG_XML_ID'], '@') !== false) {
             list($amount, $curr) = explode('@', $arBasket['CATALOG_XML_ID']);
             if ($curr == $arResult['REQUEST_ACCOUNT']) {
                 CSaleBasket::Delete($arBasket['ID']);
             }
         }
     }
     if ($arParams['PAY_IMMED']) {
         CSaleBasket::DeleteAll(CSaleBasket::GetBasketUserID());
     }
     CSaleBasket::Add(array('PRODUCT_ID' => $arResult['CURRENCIES'][$arResult['REQUEST_ACCOUNT']]['ID'], 'PRICE' => CCurrencyRates::ConvertCurrency($arResult['MONEY_OFF'], $arResult['REQUEST_ACCOUNT'], $arResult['LANG_CURRENCY']), 'CURRENCY' => $arResult['LANG_CURRENCY'], 'QUANTITY' => 1, 'LID' => LANG, 'DELAY' => 'N', 'CAN_BUY' => 'Y', 'NAME' => GetMessage('SPT_NAME_IN_CART', array('#VALUE#' => SaleFormatCurrency($arResult['REQUEST_AMOUNT'], $arResult['REQUEST_ACCOUNT']))), 'MODULE' => 'asd.money', 'DETAIL_PAGE_URL' => '', 'CATALOG_XML_ID' => $arResult['REQUEST_AMOUNT'] . '@' . $arResult['REQUEST_ACCOUNT']));
     if ($arParams['PAY_IMMED']) {
         $ORDER_ID = CSaleOrder::Add(array('LID' => SITE_ID, 'PERSON_TYPE_ID' => $arParams['PERSON_TYPE'], 'PRICE' => CCurrencyRates::ConvertCurrency($arResult['MONEY_OFF'], $arResult['REQUEST_ACCOUNT'], $arResult['LANG_CURRENCY']), 'CURRENCY' => $arResult['LANG_CURRENCY'], 'PAY_SYSTEM_ID' => $arResult['REQUEST_PAY_SYSTEM'], 'USER_ID' => $USER->getID()));
         if ($ORDER_ID > 0) {
             $arOrder = CSaleOrder::GetByID($ORDER_ID);
             CSaleBasket::OrderBasket($ORDER_ID);
         }
         $arPaySysAction = $arResult['PAY_SYSTEMS'][$arResult['REQUEST_PAY_SYSTEM']];
         if (strlen($arPaySysAction['ACTION_FILE']) > 0) {
             CSalePaySystemAction::InitParamArrays($arOrder, $ORDER_ID, $arPaySysAction['PARAMS']);
             $pathToAction = $_SERVER['DOCUMENT_ROOT'] . $arPaySysAction['ACTION_FILE'];
             $pathToAction = rtrim(str_replace('\\', '/', $pathToAction), '/');
             if (file_exists($pathToAction)) {
                 if (is_dir($pathToAction)) {
                     if (file_exists($pathToAction . '/payment.php')) {
                         include $pathToAction . '/payment.php';
                     }
                 } else {
开发者ID:Hawkart,项目名称:megatv,代码行数:31,代码来源:component.php

示例3: DoSaveOrder

 /**
  *
  *
  */
 public static function DoSaveOrder(&$arOrder, $arAdditionalFields, $orderId, &$arErrors, $arCoupons = array(), $arStoreBarcodeOrderFormData = array(), $bSaveBarcodes = false)
 {
     global $APPLICATION;
     $orderId = (int) $orderId;
     $isNew = $orderId <= 0;
     $isOrderConverted = \Bitrix\Main\Config\Option::get("main", "~sale_converted_15", 'N');
     $arFields = array("ID" => $arOrder["ID"], "LID" => $arOrder["SITE_ID"], "PERSON_TYPE_ID" => $arOrder["PERSON_TYPE_ID"], "PRICE" => $arOrder["PRICE"], "CURRENCY" => $arOrder["CURRENCY"], "USER_ID" => $arOrder["USER_ID"], "PAY_SYSTEM_ID" => $arOrder["PAY_SYSTEM_ID"], "PRICE_DELIVERY" => $arOrder["DELIVERY_PRICE"], "DELIVERY_ID" => strlen($arOrder["DELIVERY_ID"]) > 0 ? $arOrder["DELIVERY_ID"] : false, "DISCOUNT_VALUE" => $arOrder["DISCOUNT_PRICE"], "TAX_VALUE" => $arOrder["TAX_VALUE"], "TRACKING_NUMBER" => $arOrder["TRACKING_NUMBER"]);
     if ($arOrder["DELIVERY_PRICE"] == $arOrder["PRICE_DELIVERY"] && isset($arOrder['PRICE_DELIVERY_DIFF']) && floatval($arOrder['PRICE_DELIVERY_DIFF']) > 0) {
         $arFields["DELIVERY_PRICE"] = $arOrder['PRICE_DELIVERY_DIFF'] + $arOrder["PRICE_DELIVERY"];
     }
     if ($orderId <= 0) {
         $arFields["PAYED"] = "N";
         $arFields["CANCELED"] = "N";
         $arFields["STATUS_ID"] = "N";
     }
     $arFields = array_merge($arFields, $arAdditionalFields);
     if (!$arOrder['LOCATION_IN_CODES']) {
         // it comes from places like crm_invoice`s Add() and tells us if we need to convert location props from ID to CODE
         static::TranslateLocationPropertyValues($arOrder["PERSON_TYPE_ID"], $arOrder["ORDER_PROP"]);
     }
     unset($arOrder['LOCATION_IN_CODES']);
     if ($isOrderConverted == "Y") {
         $orderFields = array_merge($arOrder, $arFields, $arAdditionalFields);
         if (isset($orderFields['CUSTOM_DISCOUNT_PRICE']) && $orderFields['CUSTOM_DISCOUNT_PRICE'] === true) {
             Sale\Compatible\DiscountCompatibility::reInit(Sale\Compatible\DiscountCompatibility::MODE_DISABLED);
         }
         if (!empty($arStoreBarcodeOrderFormData)) {
             $orderFields['BARCODE_LIST'] = $arStoreBarcodeOrderFormData;
         }
         $orderFields['BARCODE_SAVE'] = $bSaveBarcodes;
         if ($orderId > 0) {
             $orderFields['ID'] = $orderId;
         }
         /** @var Sale\Result $r */
         $r = Sale\Compatible\OrderCompatibility::modifyOrder(Sale\Compatible\OrderCompatibility::ORDER_COMPAT_ACTION_SAVE, $orderFields);
         if ($r->isSuccess()) {
             $orderId = $r->getId();
         } else {
             foreach ($r->getErrorMessages() as $error) {
                 $arErrors[] = $error;
                 $APPLICATION->ThrowException($error);
             }
             return false;
         }
     } else {
         if ($orderId > 0) {
             $orderId = CSaleOrder::Update($orderId, $arFields);
         } else {
             if (COption::GetOptionString("sale", "product_reserve_condition", "O") == "O") {
                 $arFields["RESERVED"] = "Y";
             }
             $orderId = CSaleOrder::Add($arFields);
         }
         $orderId = (int) $orderId;
         if ($orderId <= 0) {
             if ($ex = $APPLICATION->GetException()) {
                 $arErrors[] = $ex->GetString();
             } else {
                 $arErrors[] = Loc::getMessage("SOA_ERROR_ORDER");
             }
         }
         if (!empty($arErrors)) {
             return null;
         }
         CSaleBasket::DoSaveOrderBasket($orderId, $arOrder["SITE_ID"], $arOrder["USER_ID"], $arOrder["BASKET_ITEMS"], $arErrors, $arCoupons, $arStoreBarcodeOrderFormData, $bSaveBarcodes);
         CSaleTax::DoSaveOrderTax($orderId, $arOrder["TAX_LIST"], $arErrors);
         CSaleOrderProps::DoSaveOrderProps($orderId, $arOrder["PERSON_TYPE_ID"], $arOrder["ORDER_PROP"], $arErrors);
         Sale\DiscountCouponsManager::finalApply();
         Sale\DiscountCouponsManager::saveApplied();
         foreach (GetModuleEvents("sale", "OnOrderSave", true) as $arEvent) {
             ExecuteModuleEventEx($arEvent, array($orderId, $arFields, $arOrder, $isNew));
         }
     }
     return $orderId;
 }
开发者ID:akniyev,项目名称:itprom_dobrohost,代码行数:79,代码来源:order.php

示例4: catch

            'STATUS_ID'        => 'N',
            'PRICE'            => 0,
            'CURRENCY'         => CCurrency::GetBaseCurrency(),
            'USER_ID'          => $order['customer']['externalId'],
            'PAY_SYSTEM_ID'    => 0,
            'PRICE_DELIVERY'   => 0,
            'DELIVERY_ID'      => 0,
            'DISCOUNT_VALUE'   => 0,
            'USER_DESCRIPTION' => ''
        );

        if(count($optionsSitesList) > 1 && $lid = array_search($order['site'], $optionsSitesList)){
            $newOrderFields['LID'] = $lid;
        }

        $externalId = CSaleOrder::Add($newOrderFields);

        if (!isset($order['externalId'])) {
            try {
                $api->orderFixExternalIds(array(array('id' => $order['id'], 'externalId' => $externalId)));
            } catch (\IntaroCrm\Exception\CurlException $e) {
                ICrmOrderActions::eventLog(
                    'ICrmOrderActions::orderHistory', 'RetailCrm\RestApi::orderFixExternalIds::CurlException',
                    $e->getCode() . ': ' . $e->getMessage()
                );

                die();
            }
        }
        $order['externalId'] = $externalId;
    }
开发者ID:Ksenobyte,项目名称:bitrix-module,代码行数:31,代码来源:history.php

示例5: __MakeOrder

		function __MakeOrder($prdCnt=1, $arData = Array())
		{
			global $APPLICATION, $USER, $DB;
			CModule::IncludeModule("iblock");
			CModule::IncludeModule("sale");
			CModule::IncludeModule("catalog");
			$arPrd = Array();
			$dbItem = CIBlockElement::GetList(Array("PROPERTY_MORE_PHOTO" => "DESC", "ID" => "ASC"), Array("IBLOCK_TYPE" => "offers", "IBLOCK_SITE_ID" => WIZARD_SITE_ID, "PROPERTY_NEWPRODUCT" => false), false, Array("nTopCount" => 10), Array("ID", "IBLOCK_ID", "XML_ID", "NAME", "DETAIL_PAGE_URL", "IBLOCK_XML_ID"));
			while($arItem = $dbItem->GetNext())
				$arPrd[] = $arItem;

			if(!empty($arPrd))
			{
				for($i=0; $i<$prdCnt;$i++)
				{
					$prdID = $arPrd[mt_rand(0, 9)];
					$arProduct = CCatalogProduct::GetByID($prdID["ID"]);
					$CALLBACK_FUNC = "";
					$arCallbackPrice = CSaleBasket::ReReadPrice($CALLBACK_FUNC, "catalog", $prdID["ID"], 1);

					$arFields = array(
							"PRODUCT_ID" => $prdID["ID"],
							"PRODUCT_PRICE_ID" => $arCallbackPrice["PRODUCT_PRICE_ID"],
							"PRICE" => $arCallbackPrice["PRICE"],
							"CURRENCY" => $arCallbackPrice["CURRENCY"],
							"WEIGHT" => $arProduct["WEIGHT"],
							"QUANTITY" => 1,
							"LID" => WIZARD_SITE_ID,
							"DELAY" => "N",
							"CAN_BUY" => "Y",
							"NAME" => $prdID["NAME"],
							"CALLBACK_FUNC" => $CALLBACK_FUNC,
							"MODULE" => "catalog",
							"PRODUCT_PROVIDER_CLASS" => "CCatalogProductProvider",
							"ORDER_CALLBACK_FUNC" => "",
							"CANCEL_CALLBACK_FUNC" => "",
							"PAY_CALLBACK_FUNC" => "",
							"DETAIL_PAGE_URL" => $prdID["DETAIL_PAGE_URL"],
							"CATALOG_XML_ID" => $prdID["IBLOCK_XML_ID"],
							"PRODUCT_XML_ID" => $prdID["XML_ID"],
							"VAT_RATE" => $arCallbackPrice['VAT_RATE'],
						);
					$addres = CSaleBasket::Add($arFields);
				}

				$arOrder = Array(
						"LID" => $arData["SITE_ID"],
						"PERSON_TYPE_ID" => $arData["PERSON_TYPE_ID"],
						"PAYED" => "N",
						"CANCELED" => "N",
						"STATUS_ID" => "N",
						"PRICE" => 1,
						"CURRENCY" => $arData["CURRENCY"],
						"USER_ID" => $arData["USER_ID"],
						"PAY_SYSTEM_ID" => $arData["PAY_SYSTEM_ID"],
						//"PRICE_DELIVERY" => $arData["PRICE_DELIVERY"],
						//"DELIVERY_ID" => $arData["DELIVERY_ID"],
					);

				$dbFUserListTmp = CSaleUser::GetList(array("USER_ID" => $arData["USER_ID"]));
				if(empty($dbFUserListTmp))
				{
					$arFields = array(
							"=DATE_INSERT" => $DB->GetNowFunction(),
							"=DATE_UPDATE" => $DB->GetNowFunction(),
							"USER_ID" => $arData["USER_ID"]
						);

					$ID = CSaleUser::_Add($arFields);
				}

				$orderID = CSaleOrder::Add($arOrder);
				CSaleBasket::OrderBasket($orderID, CSaleBasket::GetBasketUserID(), WIZARD_SITE_ID);
				$dbBasketItems = CSaleBasket::GetList(
						array("NAME" => "ASC"),
						array(
								"FUSER_ID" => CSaleBasket::GetBasketUserID(),
								"LID" => WIZARD_SITE_ID,
								"ORDER_ID" => $orderID
							),
						false,
						false,
						array("ID", "CALLBACK_FUNC", "MODULE", "PRODUCT_ID", "QUANTITY", "DELAY", "CAN_BUY", "PRICE", "WEIGHT", "NAME")
					);
				$ORDER_PRICE = 0;
				while ($arBasketItems = $dbBasketItems->GetNext())
				{
					$ORDER_PRICE += roundEx($arBasketItems["PRICE"], SALE_VALUE_PRECISION) * DoubleVal($arBasketItems["QUANTITY"]);
				}

				$totalOrderPrice = $ORDER_PRICE + $arData["PRICE_DELIVERY"];
				CSaleOrder::Update($orderID, Array("PRICE" => $totalOrderPrice));
				foreach($arData["PROPS"] as $val)
				{
					$arFields = Array(
							"ORDER_ID" => $orderID,
							"ORDER_PROPS_ID" => $val["ID"],
							"NAME" => $val["NAME"],
							"CODE" => $val["CODE"],
							"VALUE" => $val["VALUE"],
//.........这里部分代码省略.........
开发者ID:ASDAFF,项目名称:entask.ru,代码行数:101,代码来源:step1.php

示例6: IntVal

             $arFields["PAY_VOUCHER_NUM"] = $arOrder["PAY_VOUCHER_NUM"];
             $arFields["PAY_VOUCHER_DATE"] = $arOrder["PAY_VOUCHER_DATE"];
             $arFields["DELIVERY_DOC_NUM"] = $arOrder["DELIVERY_DOC_NUM"];
             $arFields["DELIVERY_DOC_DATE"] = $arOrder["DELIVERY_DOC_DATE"];
             $arFields["EMP_PAYED_ID"] = $arOrder["EMP_PAYED_ID"];
             $arFields["CANCELED"] = $arOrder["CANCELED"];
             $arFields["REASON_CANCELED"] = $arOrder["REASON_CANCELED"];
             $arFields["DATE_CANCELED"] = $arOrder["DATE_CANCELED"];
             $arFields["EMP_CANCELED_ID"] = $arOrder["EMP_CANCELED_ID"];
             $arFields["STATUS_ID"] = $arOrder["STATUS_ID"];
             $arFields["DATE_STATUS"] = $arOrder["DATE_STATUS"];
             $arFields["EMP_STATUS_ID"] = $arOrder["EMP_STATUS_ID"];
             $arFields["ALLOW_DELIVERY"] = $arOrder["ALLOW_DELIVERY"];
             $arFields["DATE_ALLOW_DELIVERY"] = $arOrder["DATE_ALLOW_DELIVERY"];
             $arFields["EMP_ALLOW_DELIVERY_ID"] = $arOrder["EMP_ALLOW_DELIVERY_ID"];
             $arIDs[$i] = CSaleOrder::Add($arFields);
             $arIDs[$i] = IntVal($arIDs[$i]);
             $res = $arIDs[$i] > 0;
         }
         if (!$res) {
             if ($ex = $APPLICATION->GetException()) {
                 $errorMessage .= $ex->GetString();
             } else {
                 $errorMessage .= GetMessage("SOE_ERROR_UPDATE") . ". ";
             }
         }
     }
 }
 if (StrLen($errorMessage) <= 0) {
     for ($i = 0; $i < count($arIDs); $i++) {
         if (IntVal($arIDs[$i]) > 0 && strlen($STATUS_ID) > 0 && $arOrder["STATUS_ID"] != $STATUS_ID) {
开发者ID:k-kalashnikov,项目名称:geekcon_new,代码行数:31,代码来源:order_edit.php

示例7: array

				// add Guest ID
				if (CModule::IncludeModule("statistic"))
					$arFields["STAT_GID"] = CStatistic::GetEventParam();

				$affiliateID = CSaleAffiliate::GetAffiliate();
				if ($affiliateID > 0)
				{
					$dbAffiliat = CSaleAffiliate::GetList(array(), array("SITE_ID" => SITE_ID, "ID" => $affiliateID));
					$arAffiliates = $dbAffiliat->Fetch();
					if (count($arAffiliates) > 1)
						$arFields["AFFILIATE_ID"] = $affiliateID;
				}
				else
					$arFields["AFFILIATE_ID"] = false;

				$arResult["ORDER_ID"] = CSaleOrder::Add($arFields);
				$arResult["ORDER_ID"] = IntVal($arResult["ORDER_ID"]);
				if ($arResult["ORDER_ID"] <= 0)
				{
					if($ex = $APPLICATION->GetException())
						$arResult["ERROR"][] = $ex->GetString();
					else
						$arResult["ERROR"][] = GetMessage("SOA_ERROR_ORDER");
				}
				else
				{
					$arOrder = CSaleOrder::GetByID($arResult["ORDER_ID"]);
				}

				if (empty($arResult["ERROR"]))
				{
开发者ID:ASDAFF,项目名称:entask.ru,代码行数:31,代码来源:component.php

示例8: elseif

                            $USER_DESCRIPTION .= $valProps['NAME'] . ' - ' . sestHL::getByIdHL(HL_BuyVariant, $valProps['VALUE'], true, 'UF_NAME') . ';';
                        } elseif ($valProps['CODE'] == 'HL_TypeLicenceIdB') {
                            $USER_DESCRIPTION .= $valProps['NAME'] . ' - ' . sestHL::getByIdHL(HL_TypeLicence, $valProps['VALUE'], true, 'UF_NAME') . ';';
                        } elseif ($valProps['CODE'] == 'HL_PeriodOfLicenceB') {
                            $USER_DESCRIPTION .= $valProps['NAME'] . ' - ' . sestHL::getByIdHL(HL_PeriodOfLicence, $valProps['VALUE'], true, 'UF_NAME') . ';';
                        } elseif ($valProps['CODE'] == 'HL_VersionB') {
                            $USER_DESCRIPTION .= $valProps['NAME'] . ' - ' . sestHL::getByIdHL(HL_Version, $valProps['VALUE'], true, 'UF_NAME') . ';';
                        }
                    }
                }
            }
            $index += 1;
        }
        //dd($USER_DESCRIPTION);
        $arFields = array("LID" => "s1", "PERSON_TYPE_ID" => 1, "PAYED" => "N", "CANCELED" => "N", "STATUS_ID" => "N", "PRICE" => $totalSum, "CURRENCY" => "UAH", "USER_ID" => IntVal($USER->GetID()), "PAY_SYSTEM_ID" => 1, "PRICE_DELIVERY" => 1, "DELIVERY_ID" => 1, "DISCOUNT_VALUE" => 0.0, "TAX_VALUE" => 0.0, "USER_DESCRIPTION" => $USER_DESCRIPTION);
        $ORDER_ID = CSaleOrder::Add($arFields);
        if ($ORDER_ID) {
            global $USER;
            $arEventFields = array("EMAIL" => $USER->GetEmail(), "ORDER_ID" => $ORDER_ID, "PRICE" => $_GET['totalSum']);
            CEvent::SendImmediate("SALE_NEW_ORDER_SEST", "s1", $arEventFields);
            //привязал корзину к заказу
            CSaleBasket::OrderBasket($ORDER_ID, 0, SITE_ID);
            //$_SESSION["SALE_USER_ID"]
            foreach ($arrCleanProducts as $key => $value) {
                $res = CSaleBasket::Update($value->elementBaskId, array('QUANTITY' => $value->quantity, 'PRICE' => $value->oneSum));
            }
        } else {
            //dd(bad);
        }
    }
}
开发者ID:VitaliiSestrenskyi,项目名称:make_offers,代码行数:31,代码来源:ajax.php

示例9: array

<?php

require_once $_SERVER['DOCUMENT_ROOT'] . "/bitrix/modules/main/include/prolog_before.php";
CModule::IncludeModule("sale");
if (isset($_GET['order_basket'])) {
    $dbBasketItems = CSaleBasket::GetList(false, array("FUSER_ID" => CSaleBasket::GetBasketUserID(), "LID" => SITE_ID, "ORDER_ID" => "NULL"), false, false, array("ID", "QUANTITY", "PRICE"));
    $price = 0;
    while ($item = $dbBasketItems->Fetch()) {
        $price += intval($item['QUANTITY']) * $item['PRICE'];
    }
    $arFields = array("LID" => 's1', "PERSON_TYPE_ID" => 1, "PAYED" => "N", "CANCELED" => "N", "STATUS_ID" => "N", "PRICE" => $price, "CURRENCY" => "RUB", "USER_ID" => intval($USER->GetId()), "PAY_SYSTEM_ID" => 1, "USER_DESCRIPTION" => "");
    $orderId = CSaleOrder::Add($arFields);
    if (false === $orderId) {
        return false;
    }
    $user = CUser::GetByID($USER->GetId())->Fetch();
    $ar = array('ORDER_ID' => $orderId, 'ORDER_PROPS_ID' => 2, "NAME" => "Адрес доставки", "CODE" => "delivery_address", 'VALUE' => $user['PERSONAL_STREET']);
    CSaleOrderPropsValue::Add($ar);
    CSaleBasket::OrderBasket($orderId, $_SESSION["SALE_USER_ID"], SITE_ID);
    $tmp = explode(',', $user['NAME']);
    $eventFields = array('NAME' => $tmp[0], 'EMAIL' => $user['EMAIL']);
    $eventName = $user['PERSONAL_CITY'] == 'Москва' ? 'NEW_ORDER_MOSCOW' : 'NEW_ORDER_RUSSIA';
    CEvent::Send($eventName, 's1', $eventFields);
    CEvent::Send('NEW_ORDER_ADMIN', 's1', array());
    return true;
}
开发者ID:ASDAFF,项目名称:mp,代码行数:26,代码来源:order.php

示例10: NextPayment


//.........这里部分代码省略.........
					{
						$arTaxSums[$arTaxList[$di]["TAX_ID"]]["VALUE"] = $arTaxList[$di]["VALUE_MONEY"];
						$arTaxSums[$arTaxList[$di]["TAX_ID"]]["NAME"] = $arTaxList[$di]["NAME"];
						if ($arTaxList[$di]["IS_IN_PRICE"] != "Y")
						{
							$taxPrice += $arTaxList[$di]["VALUE_MONEY"];
						}
					}
				}
				else
				{
					$arTaxList[0]["VALUE_MONEY"] = (($discountPrice / ($vatRate +1)) * $vatRate) * DoubleVal($arProduct["QUANTITY"]);
					$taxVatPrice = $arTaxList[0]["VALUE_MONEY"];
				}
			}


			// Changed by Sigurd, 2007-08-16
			$totalOrderPrice = $discountPrice * DoubleVal($arProduct["QUANTITY"]) + $deliveryPrice + $taxPrice;

			$arProduct["WITHOUT_ORDER"] = (($arProduct["WITHOUT_ORDER"]=="Y") ? "Y" : "N");
			if ($arProduct["WITHOUT_ORDER"] == "N")
			{
				$DB->StartTransaction();

				// Saving
				$arSaleUser = CSaleUser::GetList(Array(), Array("USER_ID" => $arOrder["USER_ID"]));
				if(!empty($arSaleUser))
				{
					$currentFUser = $arSaleUser["ID"];
				}
				else
				{
					$currentFUser = CSaleUser::_Add(
							array(
									"=DATE_INSERT" => $DB->GetNowFunction(),
									"=DATE_UPDATE" => $DB->GetNowFunction(),
									"USER_ID" => $arOrder["USER_ID"]
								)
						);
				}

				$arFields = array(
						"FUSER_ID" => $currentFUser,
						"PRODUCT_ID" => $arProduct["PRODUCT_ID"],
						"PRODUCT_NAME" => $arProduct["PRODUCT_NAME"],
						"PRODUCT_URL" => $arProduct["PRODUCT_URL"],
						"PRODUCT_PRICE_ID" => $arProduct["PRODUCT_PRICE_ID"],
						"PRICE" => $arProduct["PRICE"],
						"CURRENCY" => $arProduct["CURRENCY"],
						"WEIGHT" => $arProduct["WEIGHT"],
						"QUANTITY" => $arProduct["QUANTITY"],
						"LID" => $arOrder["LID"],
						"DELAY" => "N",
						"CAN_BUY" => "Y",
						"NAME" => $arProduct["NAME"],
						"CALLBACK_FUNC" => $arProduct["CALLBACK_FUNC"],
						"ORDER_CALLBACK_FUNC" => $arProduct["ORDER_CALLBACK_FUNC"],
						"CANCEL_CALLBACK_FUNC" => $arProduct["CANCEL_CALLBACK_FUNC"],
						"PAY_CALLBACK_FUNC" => $arProduct["PAY_CALLBACK_FUNC"],
						"PRODUCT_PROVIDER_CLASS" => $arProduct["PRODUCT_PROVIDER_CLASS"],
						"MODULE" => $arRecur["MODULE"],
						"NOTES" => $arProduct["CATALOG_GROUP_NAME"],
						"DETAIL_PAGE_URL" => $arProduct["DETAIL_PAGE_URL"],
						"VATE_RATE" => $arProduct["VATE_RATE"],
						"PRODUCT_XML_ID" => $arProduct["PRODUCT_XML_ID"],
开发者ID:ASDAFF,项目名称:bxApiDocs,代码行数:67,代码来源:recurring.php

示例11: DoSaveOrder

 /**
  *
  *
  */
 public static function DoSaveOrder(&$arOrder, $arAdditionalFields, $orderId, &$arErrors, $arCoupons = array(), $arStoreBarcodeOrderFormData = array(), $bSaveBarcodes = false)
 {
     global $APPLICATION;
     $orderId = (int) $orderId;
     $isNew = $orderId <= 0;
     $isOrderConverted = \Bitrix\Main\Config\Option::get("main", "~sale_converted_15", 'N');
     $arFields = array("ID" => $arOrder["ID"], "LID" => $arOrder["SITE_ID"], "PERSON_TYPE_ID" => $arOrder["PERSON_TYPE_ID"], "PRICE" => $arOrder["PRICE"], "CURRENCY" => $arOrder["CURRENCY"], "USER_ID" => $arOrder["USER_ID"], "PAY_SYSTEM_ID" => $arOrder["PAY_SYSTEM_ID"], "PRICE_DELIVERY" => $arOrder["DELIVERY_PRICE"], "DELIVERY_ID" => strlen($arOrder["DELIVERY_ID"]) > 0 ? $arOrder["DELIVERY_ID"] : false, "DISCOUNT_VALUE" => $arOrder["DISCOUNT_PRICE"], "TAX_VALUE" => $arOrder["TAX_VALUE"], "TRACKING_NUMBER" => $arOrder["TRACKING_NUMBER"]);
     if ($arOrder["DELIVERY_PRICE"] == $arOrder["PRICE_DELIVERY"] && isset($arOrder['PRICE_DELIVERY_DIFF']) && floatval($arOrder['PRICE_DELIVERY_DIFF']) > 0) {
         $arFields["DELIVERY_PRICE"] = $arOrder['PRICE_DELIVERY_DIFF'] + $arOrder["PRICE_DELIVERY"];
     }
     if ($orderId <= 0) {
         $arFields["PAYED"] = "N";
         $arFields["CANCELED"] = "N";
         $arFields["STATUS_ID"] = "N";
     }
     $arFields = array_merge($arFields, $arAdditionalFields);
     if (!$arOrder['LOCATION_IN_CODES']) {
         // it comes from places like crm_invoice`s Add() and tells us if we need to convert location props from ID to CODE
         static::TranslateLocationPropertyValues($arOrder["PERSON_TYPE_ID"], $arOrder["ORDER_PROP"]);
     }
     unset($arOrder['LOCATION_IN_CODES']);
     if ($isOrderConverted == "Y") {
         $orderFields = array_merge($arOrder, $arFields, $arAdditionalFields);
         if (!empty($arStoreBarcodeOrderFormData)) {
             $orderFields['BARCODE_LIST'] = $arStoreBarcodeOrderFormData;
         }
         $orderFields['BARCODE_SAVE'] = $bSaveBarcodes;
         if ($orderId > 0) {
             $orderFields['ID'] = $orderId;
         }
         /** @var Sale\Result $r */
         $r = Sale\Compatible\OrderCompatibility::modifyOrder(Sale\Compatible\OrderCompatibility::ORDER_COMPAT_ACTION_SAVE, $orderFields);
         if ($r->isSuccess()) {
             $orderId = $r->getId();
         } else {
             foreach ($r->getErrorMessages() as $error) {
                 $arErrors[] = $error;
                 $APPLICATION->ThrowException($error);
             }
             return false;
         }
     } else {
         if ($orderId > 0) {
             $orderId = CSaleOrder::Update($orderId, $arFields);
         } else {
             if (COption::GetOptionString("sale", "product_reserve_condition", "O") == "O") {
                 $arFields["RESERVED"] = "Y";
             }
             $orderId = CSaleOrder::Add($arFields);
         }
         $orderId = (int) $orderId;
         if ($orderId <= 0) {
             if ($ex = $APPLICATION->GetException()) {
                 $arErrors[] = $ex->GetString();
             } else {
                 $arErrors[] = Loc::getMessage("SOA_ERROR_ORDER");
             }
         }
         if (!empty($arErrors)) {
             return null;
         }
         CSaleBasket::DoSaveOrderBasket($orderId, $arOrder["SITE_ID"], $arOrder["USER_ID"], $arOrder["BASKET_ITEMS"], $arErrors, $arCoupons, $arStoreBarcodeOrderFormData, $bSaveBarcodes);
         CSaleTax::DoSaveOrderTax($orderId, $arOrder["TAX_LIST"], $arErrors);
         CSaleOrderProps::DoSaveOrderProps($orderId, $arOrder["PERSON_TYPE_ID"], $arOrder["ORDER_PROP"], $arErrors);
         Sale\DiscountCouponsManager::finalApply();
         Sale\DiscountCouponsManager::saveApplied();
         foreach (GetModuleEvents("sale", "OnOrderSave", true) as $arEvent) {
             ExecuteModuleEventEx($arEvent, array($orderId, $arFields, $arOrder, $isNew));
         }
     }
     /*
     			// mail message
     			if (empty($arResult["ERROR"]))
     			{
     				$strOrderList = "";
     				$dbBasketItems = CSaleBasket::GetList(
     						array("NAME" => "ASC"),
     						array("ORDER_ID" => $arResult["ORDER_ID"]),
     						false,
     						false,
     						array("ID", "NAME", "QUANTITY", "PRICE", "CURRENCY")
     					);
     				while ($arBasketItems = $dbBasketItems->Fetch())
     				{
     					$strOrderList .= $arBasketItems["NAME"]." - ".$arBasketItems["QUANTITY"]." ".Loc::getMessage("SOA_SHT").": ".SaleFormatCurrency($arBasketItems["PRICE"], $arBasketItems["CURRENCY"]);
     					$strOrderList .= "\n";
     				}
     
     				$arFields = Array(
     					"ORDER_ID" => $arResult["ORDER_ID"],
     					"ORDER_DATE" => Date($DB->DateFormatToPHP(CLang::GetDateFormat("SHORT", SITE_ID))),
     					"ORDER_USER" => ( (strlen($arUserResult["PAYER_NAME"]) > 0) ? $arUserResult["PAYER_NAME"] : $USER->GetFullName() ),
     					"PRICE" => SaleFormatCurrency($totalOrderPrice, $arResult["BASE_LANG_CURRENCY"]),
     					"BCC" => COption::GetOptionString("sale", "order_email", "order@".$SERVER_NAME),
     					"EMAIL" => (strlen($arUserResult["USER_EMAIL"])>0 ? $arUserResult["USER_EMAIL"] : $USER->GetEmail()),
     					"ORDER_LIST" => $strOrderList,
//.........这里部分代码省略.........
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:101,代码来源:order.php

示例12: AddProduct

    public static function AddProduct ($idProduct, $quantity, $arRewriteFields, $arProductParams, $userId, $currency, $personType, $clearCart) {
		if (CModule::IncludeModule("catalog")) {
			
			global $DB;
			global $USER;
				
			if ($clearCart == "Y" && (int)$idProduct > 0) {
				CSaleBasket::DeleteAll(CSaleBasket::GetBasketUserID());
			}
			
			if (Add2BasketByProductID( $idProduct, $quantity, $arRewriteFields, $arProductParams)) { // В корзину
			
				// Получаю параметры корзины
				$dbBasketItems = CSaleBasket::GetList(array("NAME" => "ASC", "ID" => "ASC"), array("FUSER_ID" => CSaleBasket::GetBasketUserID(), "ORDER_ID" => "NULL"), false, false, array("ID", "PRODUCT_ID", "QUANTITY", "DELAY", "CAN_BUY", "PRICE", "NAME"));
				while ($arItems = $dbBasketItems->Fetch())	{
						$arBasketItems[] = $arItems;
				}
				
				foreach ($arBasketItems as $valBasketItems) {
					$productPriceSumm = $productPriceSumm + ((int)$valBasketItems["QUANTITY"]*(int)$valBasketItems["PRICE"]);
				}
				
				
				$strOrderList = "";

				foreach ($arBasketItems as $arItem)
				{
					$measureText = (isset($arItem["MEASURE_TEXT"]) && strlen($arItem["MEASURE_TEXT"])) ? $arItem["MEASURE_TEXT"] : GetMessage("SOA_SHT");

					$strOrderList .= $arItem["NAME"]." - ".$arItem["QUANTITY"]." ".$measureText.": ".SaleFormatCurrency($arItem["PRICE"], $arItem["CURRENCY"]);
					$strOrderList .= "\n";
				}
				
				
				// Создаю заказ
				$arOrderFields = array(
					"LID" => SITE_ID,
					"PERSON_TYPE_ID" => $personType,
					"PAYED" => "N",
					"CANCELED" => "N",
					"STATUS_ID" => "N",
					"PRICE" => $productPriceSumm,
					"CURRENCY" => $currency,
					"USER_ID" => $userId,
					"USER_DESCRIPTION" => "",
					"ADDITIONAL_INFO" => ""
				);
				
				$ORDER_ID = CSaleOrder::Add($arOrderFields);
				
				// Привязываем товары из корзины текущего пользователя к заказу			
				
				CSaleBasket::OrderBasket($ORDER_ID, CSaleBasket::GetBasketUserID(), SITE_ID, false);

				$rsUser = CUser::GetByID($userId);
				$arUser = $rsUser->Fetch();
				
				$arFields = Array(
					"ORDER_ID" => $ORDER_ID,
					"ORDER_DATE" => Date($DB->DateFormatToPHP(CLang::GetDateFormat("SHORT", SITE_ID))),
					"ORDER_USER" => $arUser["NAME"],
					"PRICE" => $productPriceSumm,
					"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),
						
				);

				$eventName = "SALE_NEW_ORDER";

					$event = new CEvent;
					$event->Send($eventName, SITE_ID, $arFields, "N");
					
				
				return $ORDER_ID;
				
			}

			
		} else {
			return false;
		}
	}
开发者ID:ASDAFF,项目名称:order_click,代码行数:84,代码来源:class.php

示例13: __MakeOrder

 function __MakeOrder($prdCnt = 1, $arData = array())
 {
     global $APPLICATION, $USER, $DB;
     CModule::IncludeModule("iblock");
     CModule::IncludeModule("sale");
     CModule::IncludeModule("catalog");
     $arPrd = array();
     $dbItem = CIBlockElement::GetList(array(), array("IBLOCK_TYPE" => "offers", "IBLOCK_SITE_ID" => WIZARD_SITE_ID, "PROPERTY_NEWPRODUCT" => false), false, array("nTopCount" => 100), array("ID", "IBLOCK_ID", "XML_ID", "NAME", "DETAIL_PAGE_URL", "IBLOCK_XML_ID"));
     while ($arItem = $dbItem->GetNext()) {
         $arPrd[] = $arItem;
     }
     if (!empty($arPrd)) {
         $arOrder = array("LID" => $arData["SITE_ID"], "PERSON_TYPE_ID" => $arData["PERSON_TYPE_ID"], "PAYED" => "N", "CANCELED" => "N", "STATUS_ID" => "N", "PRICE" => 1, "CURRENCY" => $arData["CURRENCY"], "USER_ID" => $arData["USER_ID"], "PAY_SYSTEM_ID" => $arData["PAY_SYSTEM_ID"]);
         $fuserID = 0;
         $dbFUserListTmp = CSaleUser::GetList(array("USER_ID" => $arData["USER_ID"]));
         if (empty($dbFUserListTmp)) {
             $arFields = array("=DATE_INSERT" => $DB->GetNowFunction(), "=DATE_UPDATE" => $DB->GetNowFunction(), "USER_ID" => $arData["USER_ID"]);
             $fuserID = CSaleUser::_Add($arFields);
         } else {
             $fuserID = $dbFUserListTmp['ID'];
         }
         $orderID = CSaleOrder::Add($arOrder);
         CCatalogProduct::setPriceVatIncludeMode(true);
         CCatalogProduct::setUsedCurrency(CSaleLang::GetLangCurrency(WIZARD_SITE_ID));
         CCatalogProduct::setUseDiscount(true);
         for ($i = 0; $i < $prdCnt; $i++) {
             $prdID = $arPrd[mt_rand(20, 99)];
             $arProduct = CCatalogProduct::GetByID($prdID["ID"]);
             $arPrice = CCatalogProduct::GetOptimalPrice($prdID["ID"], 1, array(2), 'N', array(), WIZARD_SITE_ID, array());
             $arFields = array("IGNORE_CALLBACK_FUNC" => "Y", "PRODUCT_ID" => $prdID["ID"], "PRODUCT_PRICE_ID" => $arPrice['PRICE']['ID'], "BASE_PRICE" => $arPrice['RESULT_PRICE']['BASE_PRICE'], "PRICE" => $arPrice['RESULT_PRICE']['DISCOUNT_PRICE'], "VAT_RATE" => $arPrice['PRICE']['VAT_RATE'], "CURRENCY" => $arPrice['RESULT_PRICE']['CURRENCY'], "WEIGHT" => $arProduct["WEIGHT"], "DIMENSIONS" => serialize(array("WIDTH" => $arProduct["WIDTH"], "HEIGHT" => $arProduct["HEIGHT"], "LENGTH" => $arProduct["LENGTH"])), "QUANTITY" => 1, "LID" => WIZARD_SITE_ID, "DELAY" => "N", "CAN_BUY" => "Y", "NAME" => $prdID["NAME"], "CALLBACK_FUNC" => "", "MODULE" => "catalog", "PRODUCT_PROVIDER_CLASS" => "CCatalogProductProvider", "ORDER_CALLBACK_FUNC" => "", "CANCEL_CALLBACK_FUNC" => "", "PAY_CALLBACK_FUNC" => "", "DETAIL_PAGE_URL" => $prdID["DETAIL_PAGE_URL"], "CATALOG_XML_ID" => $prdID["IBLOCK_XML_ID"], "PRODUCT_XML_ID" => $prdID["XML_ID"], "NOTES" => $arPrice["PRICE"]["CATALOG_GROUP_NAME"], "FUSER_ID" => $fuserID, "ORDER_ID" => $orderID);
             $addres = CSaleBasket::Add($arFields);
         }
         $dbBasketItems = CSaleBasket::GetList(array(), array("ORDER_ID" => $orderID), false, false, array("ID", "QUANTITY", "PRICE"));
         $ORDER_PRICE = 0;
         while ($arBasketItems = $dbBasketItems->GetNext()) {
             $ORDER_PRICE += roundEx($arBasketItems["PRICE"], SALE_VALUE_PRECISION) * DoubleVal($arBasketItems["QUANTITY"]);
         }
         $totalOrderPrice = $ORDER_PRICE + $arData["PRICE_DELIVERY"];
         CSaleOrder::Update($orderID, array("PRICE" => $totalOrderPrice));
         foreach ($arData["PROPS"] as $val) {
             $arFields = array("ORDER_ID" => $orderID, "ORDER_PROPS_ID" => $val["ID"], "NAME" => $val["NAME"], "CODE" => $val["CODE"], "VALUE" => $val["VALUE"]);
             CSaleOrderPropsValue::Add($arFields);
         }
         return $orderID;
     }
 }
开发者ID:webgksupport,项目名称:alpina,代码行数:46,代码来源:step1.php

示例14: orderHistory


//.........这里部分代码省略.........
                     $optionsOrderTypes[$order['orderType']] = $orderType;
                 } else {
                     $optionsOrderTypes[$order['orderType']] = $defaultOrderType;
                 }
             }
             // we dont need new orders without any customers (can check only for externalId)
             if (!isset($order['customer']['externalId'])) {
                 if (!isset($order['customer']['id'])) {
                     continue;
                 }
                 $registerNewUser = true;
                 if (!isset($order['customer']['email']) || $order['customer']['email'] == '') {
                     $login = $order['customer']['email'] = uniqid('user_' . time()) . '@crm.com';
                 } else {
                     $dbUser = CUser::GetList($by = 'ID', $sort = 'ASC', array('=EMAIL' => $order['email']));
                     switch ($dbUser->SelectedRowsCount()) {
                         case 0:
                             $login = $order['customer']['email'];
                             break;
                         case 1:
                             $arUser = $dbUser->Fetch();
                             $registeredUserID = $arUser['ID'];
                             $registerNewUser = false;
                             break;
                         default:
                             $login = uniqid('user_' . time()) . '@crm.com';
                             break;
                     }
                 }
                 if ($registerNewUser === true) {
                     $userPassword = uniqid();
                     $newUser = new CUser();
                     $arFields = array("NAME" => self::fromJSON($order['customer']['firstName']), "LAST_NAME" => self::fromJSON($order['customer']['lastName']), "EMAIL" => $order['customer']['email'], "LOGIN" => $login, "LID" => "ru", "ACTIVE" => "Y", "PASSWORD" => $userPassword, "CONFIRM_PASSWORD" => $userPassword);
                     $registeredUserID = $newUser->Add($arFields);
                     if ($registeredUserID === false) {
                         self::eventLog('ICrmOrderActions::orderHistory', 'CUser::Register', 'Error register user');
                         continue;
                     }
                     try {
                         $api->customerFixExternalIds(array(array('id' => $order['customer']['id'], 'externalId' => $registeredUserID)));
                     } catch (\RetailCrm\Exception\CurlException $e) {
                         self::eventLog('ICrmOrderActions::orderHistory', 'RetailCrm\\RestApi::customerFixExternalIds::CurlException', $e->getCode() . ': ' . $e->getMessage());
                         continue;
                     }
                 }
                 $order['customer']['externalId'] = $registeredUserID;
             }
             // new order
             $newOrderFields = array('LID' => CSite::GetDefSite(), 'PERSON_TYPE_ID' => isset($optionsOrderTypes[$order['orderType']]) ? $optionsOrderTypes[$order['orderType']] : $defaultOrderType, 'PAYED' => 'N', 'CANCELED' => 'N', 'STATUS_ID' => 'N', 'PRICE' => 0, 'CURRENCY' => CCurrency::GetBaseCurrency(), 'USER_ID' => $order['customer']['externalId'], 'PAY_SYSTEM_ID' => 0, 'PRICE_DELIVERY' => 0, 'DELIVERY_ID' => 0, 'DISCOUNT_VALUE' => 0, 'USER_DESCRIPTION' => '');
             if (count($optionsSitesList) > 1 && ($lid = array_search($order['site'], $optionsSitesList))) {
                 $newOrderFields['LID'] = $lid;
             }
             $externalId = CSaleOrder::Add($newOrderFields);
             if (!isset($order['externalId'])) {
                 try {
                     $api->orderFixExternalIds(array(array('id' => $order['id'], 'externalId' => $externalId)));
                 } catch (\RetailCrm\Exception\CurlException $e) {
                     self::eventLog('ICrmOrderActions::orderHistory', 'RetailCrm\\RestApi::orderFixExternalIds::CurlException', $e->getCode() . ': ' . $e->getMessage());
                     continue;
                 }
             }
             $order['externalId'] = $externalId;
         }
         if (isset($order['externalId']) && $order['externalId']) {
             // custom orderType function
             if (function_exists('intarocrm_set_order_type')) {
开发者ID:Ksenobyte,项目名称:bitrix-module,代码行数:67,代码来源:ICrmOrderActions.php

示例15: DoSaveOrder

 static function DoSaveOrder(&$arOrder, $arAdditionalFields, $orderId, &$arErrors, $arCoupons = array(), $arStoreBarcodeOrderFormData = array(), $bSaveBarcodes = false)
 {
     global $APPLICATION;
     $orderId = intval($orderId);
     $arFields = array("LID" => $arOrder["SITE_ID"], "PERSON_TYPE_ID" => $arOrder["PERSON_TYPE_ID"], "PRICE" => $arOrder["PRICE"], "CURRENCY" => $arOrder["CURRENCY"], "USER_ID" => $arOrder["USER_ID"], "PAY_SYSTEM_ID" => $arOrder["PAY_SYSTEM_ID"], "PRICE_DELIVERY" => $arOrder["DELIVERY_PRICE"], "DELIVERY_ID" => strlen($arOrder["DELIVERY_ID"]) > 0 ? $arOrder["DELIVERY_ID"] : false, "DISCOUNT_VALUE" => $arOrder["DISCOUNT_PRICE"], "TAX_VALUE" => $arOrder["TAX_VALUE"]);
     if ($orderId <= 0) {
         $arFields["PAYED"] = "N";
         $arFields["CANCELED"] = "N";
         $arFields["STATUS_ID"] = "N";
     }
     $arFields = array_merge($arFields, $arAdditionalFields);
     if ($orderId > 0) {
         $orderId = CSaleOrder::Update($orderId, $arFields);
     } else {
         if (COption::GetOptionString("sale", "product_reserve_condition", "O") == "O") {
             $arFields["RESERVED"] = "Y";
         }
         $orderId = CSaleOrder::Add($arFields);
     }
     $orderId = intval($orderId);
     if ($orderId <= 0) {
         if ($ex = $APPLICATION->GetException()) {
             $arErrors[] = $ex->GetString();
         } else {
             $arErrors[] = GetMessage("SOA_ERROR_ORDER");
         }
     }
     if (count($arErrors) > 0) {
         return null;
     }
     CSaleBasket::DoSaveOrderBasket($orderId, $arOrder["SITE_ID"], $arOrder["USER_ID"], $arOrder["BASKET_ITEMS"], $arErrors, $arCoupons, $arStoreBarcodeOrderFormData, $bSaveBarcodes);
     CSaleTax::DoSaveOrderTax($orderId, $arOrder["TAX_LIST"], $arErrors);
     CSaleOrderProps::DoSaveOrderProps($orderId, $arOrder["PERSON_TYPE_ID"], $arOrder["ORDER_PROP"], $arErrors);
     /*
     			// mail message
     			if (empty($arResult["ERROR"]))
     			{
     				$strOrderList = "";
     				$dbBasketItems = CSaleBasket::GetList(
     						array("NAME" => "ASC"),
     						array("ORDER_ID" => $arResult["ORDER_ID"]),
     						false,
     						false,
     						array("ID", "NAME", "QUANTITY", "PRICE", "CURRENCY")
     					);
     				while ($arBasketItems = $dbBasketItems->Fetch())
     				{
     					$strOrderList .= $arBasketItems["NAME"]." - ".$arBasketItems["QUANTITY"]." ".GetMessage("SOA_SHT").": ".SaleFormatCurrency($arBasketItems["PRICE"], $arBasketItems["CURRENCY"]);
     					$strOrderList .= "\n";
     				}
     
     				$arFields = Array(
     					"ORDER_ID" => $arResult["ORDER_ID"],
     					"ORDER_DATE" => Date($DB->DateFormatToPHP(CLang::GetDateFormat("SHORT", SITE_ID))),
     					"ORDER_USER" => ( (strlen($arUserResult["PAYER_NAME"]) > 0) ? $arUserResult["PAYER_NAME"] : $USER->GetFullName() ),
     					"PRICE" => SaleFormatCurrency($totalOrderPrice, $arResult["BASE_LANG_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),
     					"DELIVERY_PRICE" => $arResult["DELIVERY_PRICE"],
     				);
     				$eventName = "SALE_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, $arFields, "N");
     				}
     			}
     
     			if(CModule::IncludeModule("statistic"))
     			{
     				$event1 = "eStore";
     				$event2 = "order_confirm";
     				$event3 = $arResult["ORDER_ID"];
     
     				$e = $event1."/".$event2."/".$event3;
     
     				if(!is_array($_SESSION["ORDER_EVENTS"]) || (is_array($_SESSION["ORDER_EVENTS"]) && !in_array($e, $_SESSION["ORDER_EVENTS"])))
     				{
     						CStatistic::Set_Event($event1, $event2, $event3);
     						$_SESSION["ORDER_EVENTS"][] = $e;
     				}
     			}
     			$arOrder = CSaleOrder::GetByID($arResult["ORDER_ID"]);
     			foreach(GetModuleEvents("sale", "OnSaleComponentOrderOneStepComplete", true) as $arEvent)
     				ExecuteModuleEventEx($arEvent, Array($arResult["ORDER_ID"], $arOrder));
     */
     return $orderId;
 }
开发者ID:k-kalashnikov,项目名称:geekcon_new,代码行数:96,代码来源:order.php


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