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


PHP CSaleBasket::DoSaveOrderBasket方法代码示例

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


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

示例1: nodeHandler


//.........这里部分代码省略.........
										{
											$bNeedUpdate = true;
											//CSaleBasket::Delete($arBasket["ID"]);
										}
									}
								}

								if(!empty($arOrder["items"]))
								{
									foreach ($arOrder["items"] as $itemID => $arItem)
									{
										if ($arItem["CHECKED"] != "Y")
										{
											if ($arItem["TYPE"] == GetMessage("CC_BSC1_ITEM"))
											{
												if ($arBasketFields = $this->prepareProduct4Basket($itemID, $arItem, $orderId, $orderInfo))
												{
													$arShoppingCart[] = $arBasketFields;
													$bNeedUpdate = true;
												}
											}
											elseif ($arItem["TYPE"] == GetMessage("CC_BSC1_SERVICE"))
											{
												if (IntVal($arItem["PRICE"]) != IntVal($orderInfo["PRICE_DELIVERY"]))
													$arOrderFields["PRICE_DELIVERY"] = $arItem["PRICE"];
											}
										}
									}
								}

								if($bNeedUpdate)
								{
									$arErrors = array();
									CSaleBasket::DoSaveOrderBasket($orderId, $orderInfo["LID"], $orderInfo["USER_ID"], $arShoppingCart, $arErrors);
								}

								if(DoubleVal($arOrder["AMOUNT"]) > 0 && $arOrder["AMOUNT"] != $orderInfo["PRICE"])
									$arOrderFields["PRICE"] = $arOrder["AMOUNT"];
								if(DoubleVal($orderInfo["DISCOUNT_VALUE"]) > 0)
									$arOrderFields["DISCOUNT_VALUE"] = 0;
								if(strlen($arOrder["COMMENT"]) > 0 && $arOrder["COMMENT"] != $orderInfo["COMMENTS"])
									$arOrderFields["COMMENTS"] = $arOrder["COMMENT"];
								$arOrderFields["UPDATED_1C"] = "Y";
								if(!empty($arOrderFields))
									CSaleOrder::Update($orderId, $arOrderFields);
							}
							else
							{
								$this->strError .= "\n".GetMessage("CC_BSC1_FINAL_NOT_EDIT", Array("#ID#" => $orderId));
							}
						}

						$arAditFields = Array();
						if($arOrder["TRAITS"][GetMessage("CC_BSC1_CANCELED")] == "true")
						{
							if($orderInfo["CANCELED"] == "N")
								CSaleOrder::CancelOrder($orderInfo["ID"], "Y", $arOrder["COMMENT"]);
							$arAditFields["UPDATED_1C"] = "Y";
						}
						else
						{
							if(strlen($arOrder["TRAITS"][GetMessage("CC_BSC1_1C_PAYED_DATE")])>1)
							{
								if($orderInfo["PAYED"]=="N")
									CSaleOrder::PayOrder($orderInfo["ID"], "Y");
								$arAditFields["PAY_VOUCHER_DATE"] = CDatabase::FormatDate(str_replace("T", " ", $arOrder["TRAITS"][GetMessage("CC_BSC1_1C_PAYED_DATE")]), "YYYY-MM-DD HH:MI:SS", CLang::GetDateFormat("FULL", LANG));
开发者ID:ASDAFF,项目名称:1C_Bitrix_info_site,代码行数:67,代码来源:order_loader.php

示例2: 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

示例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 (!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

示例4: 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


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