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


PHP CSaleBasketHelper::isSetParent方法代码示例

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


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

示例1: checkQuantity

 public static function checkQuantity($arProducts)
 {
     $result = true;
     $sumQuantityOnStores = array();
     foreach ($arProducts as $id => $arProduct) {
         if (CSaleBasketHelper::isSetParent($arProduct)) {
             continue;
         }
         if (!empty($arProduct["STORES"]) && is_array($arProduct["STORES"])) {
             $sumQuantityOnStores[$id] = 0;
             foreach ($arProduct["STORES"] as $arStore) {
                 $sumQuantityOnStores[$id] += $arStore["QUANTITY"];
             }
             if ($sumQuantityOnStores[$id] != $arProduct["QUANTITY"]) {
                 $GLOBALS["APPLICATION"]->ThrowException(GetMessage("NEWO_ERR_STORE_QUANTITY_NOT_EQUAL_TOTAL_QUANTITY", array("#PRODUCT_NAME#" => $arProduct["NAME"])) . "<br>");
                 $result = false;
                 break;
             }
         } else {
             $GLOBALS["APPLICATION"]->ThrowException(GetMessage("NEWO_ERR_STORE_WRONG_INFO", array("#PRODUCT_NAME#" => $arProduct["NAME"])) . "<br>");
             $result = false;
             break;
         }
     }
     return $result;
 }
开发者ID:Satariall,项目名称:izurit,代码行数:26,代码来源:order_helper.php

示例2: array

$arBasketItems = array();
$arSetParentWeight = array();
$fuserId = (int) CSaleBasket::GetBasketUserID(true);
if ($fuserId > 0) {
    $rsBaskets = CSaleBasket::GetList(array("ID" => "ASC"), array("FUSER_ID" => $fuserId, "LID" => SITE_ID, "ORDER_ID" => "NULL"), false, false, array("ID", "NAME", "CALLBACK_FUNC", "MODULE", "PRODUCT_ID", "QUANTITY", "DELAY", "CAN_BUY", "PRICE", "WEIGHT", "DETAIL_PAGE_URL", "NOTES", "CURRENCY", "VAT_RATE", "CATALOG_XML_ID", "PRODUCT_XML_ID", "SUBSCRIBE", "DISCOUNT_PRICE", "PRODUCT_PROVIDER_CLASS", "TYPE", "SET_PARENT_ID"));
    while ($arItem = $rsBaskets->GetNext()) {
        $arBasketItems[] = $arItem;
        if (CSaleBasketHelper::isSetItem($arItem)) {
            $arSetParentWeight[$arItem["SET_PARENT_ID"]] += $arItem["WEIGHT"] * $arItem['QUANTITY'];
        }
    }
}
if (!empty($arBasketItems)) {
    // count weight for set parent products
    foreach ($arBasketItems as &$arItem) {
        if (CSaleBasketHelper::isSetParent($arItem)) {
            $arItem["WEIGHT"] = $arSetParentWeight[$arItem["ID"]] / $arItem["QUANTITY"];
        }
    }
    unset($arItem);
    foreach ($arBasketItems as &$arItem) {
        if (CSaleBasketHelper::isSetItem($arItem)) {
            continue;
        }
        $boolOneReady = false;
        if ($arItem["DELAY"] == "N" && $arItem["CAN_BUY"] == "Y") {
            $boolOneReady = true;
            $bReady = true;
            $allSum += $arItem["PRICE"] * $arItem["QUANTITY"];
            $allWeight += $arItem["WEIGHT"] * $arItem["QUANTITY"];
        } elseif ($arItem["DELAY"] == "Y" && $arItem["CAN_BUY"] == "Y") {
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:31,代码来源:component.php

示例3: data

								}
							}
							?>
						</div>
					</td>

					<!-- barcode data (form popup button if BARCODE_MULTI = Y or input field) -->
					<td class="store_barcode" id="store_barcode_block_<?php 
echo $val["ID"];
?>
" <?php 
echo $useStores && ($str_DEDUCTED == "Y" || $hasSavedBarcodes) ? "" : 'style="display:none;"';
?>
>
						<div style="display:<?php 
echo !CSaleBasketHelper::isSetParent($val) ? '' : 'none';
?>
;">
							<?
							if ($hasValidStores)
							{
								if ($arBasketItem[$val["ID"]]["HAS_SAVED_QUANTITY"] == "Y")
								{
									$ind = 0;
									foreach ($arBasketItem[$val["ID"]]["STORES"] as $storeId => $arStore)
									{
										if (isset($arStore["QUANTITY"]) && $val["BARCODE_MULTI"] == "Y")
										{
										?>
										<div id="store_barcode_wrapper_<?php 
echo $val["ID"];
开发者ID:ASDAFF,项目名称:entask.ru,代码行数:31,代码来源:order_new.php

示例4: parseBasketItems

 /**
  * @param Sale\Basket $basket
  * @param array $requestBasketItems
  *
  * @return Sale\Result
  * @throws Main\ArgumentNullException
  * @throws Main\ArgumentTypeException
  * @throws Main\ObjectException
  * @throws Main\ObjectNotFoundException
  */
 protected function parseBasketItems(Sale\Basket $basket, array $requestBasketItems)
 {
     $result = new Sale\Result();
     $basketCodeList = array();
     $basketItemList = array();
     $basketParentList = array();
     $basketChildList = array();
     $basketChanged = false;
     $publicMode = DiscountCompatibility::usedByClient();
     foreach ($requestBasketItems as $basketIndex => $basketItemData) {
         if (isset($basketItemData['SET_PARENT_ID']) && strval($basketItemData['SET_PARENT_ID']) != '') {
             $parentId = intval($basketItemData['SET_PARENT_ID']);
             if ($basketItemData['TYPE'] != Sale\Basket::TYPE_SET && !array_key_exists($parentId, $basketParentList)) {
                 $basketChildList[intval($basketItemData['SET_PARENT_ID'])] = $basketItemData['SET_PARENT_ID'];
             }
         }
     }
     $orderCompatibility = $this->getOrderCompatibility();
     /** @var Sale\Order $order */
     $order = $orderCompatibility->getOrder();
     $basketItemsIndexList = array();
     foreach ($basket as $basketItem) {
         $basketItemsIndexList[$basketItem->getId()] = true;
     }
     foreach ($requestBasketItems as $basketIndex => $basketItemData) {
         $basketItem = null;
         if (isset($basketItemData['ID']) && intval($basketItemData['ID']) > 0) {
             /** @var Sale\BasketItem $basketItem */
             if ($basketItem = $basket->getItemById($basketItemData['ID'])) {
                 if (isset($basketItemsIndexList[$basketItem->getId()])) {
                     unset($basketItemsIndexList[$basketItem->getId()]);
                 }
             }
         }
         if (!$basketItem) {
             /** @var Sale\BasketItem $basketItem */
             $basketItem = Sale\BasketItem::create($basket, $basketItemData['MODULE'], $basketItemData['PRODUCT_ID']);
             $basketChanged = true;
         }
         $itemDuplicate = isset($basketItemData['DUPLICATE']) && $basketItemData['DUPLICATE'] == "Y";
         $basketFields = static::clearFields($basketItemData);
         //			$basketFields['BASKET_CODE'] = $basketItem->getBasketCode();
         if ($order->getId() > 0) {
             /** @var Sale\ShipmentCollection $shipmentCollection */
             if ($shipmentCollection = $order->getShipmentCollection()) {
                 if (count($shipmentCollection) == 2 && (isset($basketItemData['QUANTITY']) && floatval($basketItemData['QUANTITY']) <= $basketItem->getQuantity())) {
                     /** @var Sale\Shipment $shipment */
                     foreach ($shipmentCollection as $shipment) {
                         if ($shipment->isSystem()) {
                             continue;
                         }
                         $basketQuantity = $shipment->getBasketItemQuantity($basketItem);
                         if ($basketQuantity <= floatval($basketItemData['QUANTITY'])) {
                             continue;
                         }
                         /** @var Sale\ShipmentItemCollection $shipmentItemCollection */
                         if ($shipmentItemCollection = $shipment->getShipmentItemCollection()) {
                             /** @var Sale\ShipmentItem $shipmentItem */
                             if (!($shipmentItem = $shipmentItemCollection->getItemByBasketCode($basketItem->getBasketCode()))) {
                                 continue;
                             }
                             $shipmentItem->setQuantity(floatval($basketItemData['QUANTITY']));
                         }
                     }
                 }
             }
         }
         $isBasketItemCanBeAdded = true;
         if ($publicMode) {
             if (\CSaleBasketHelper::isSetParent($basketItemData)) {
                 $parentId = (int) $basketItemData['ID'];
                 $parentCode = $basketItemData['ID'];
             } else {
                 $parentId = (int) $basketItemData['SET_PARENT_ID'];
                 $parentCode = $basketItemData['SET_PARENT_ID'];
             }
         } else {
             $parentId = (int) $basketItemData['SET_PARENT_ID'];
             $parentCode = $basketItemData['SET_PARENT_ID'];
         }
         if ($parentId > 0) {
             if ($basketItem->isBundleParent()) {
                 $basketParentList[$parentCode] = $basketItem->getBasketCode();
             } else {
                 $isBasketItemCanBeAdded = false;
                 $basketItemList[$parentCode][$basketIndex] = $basketItem;
             }
         }
         if ($isBasketItemCanBeAdded) {
             $propList = array();
//.........这里部分代码省略.........
开发者ID:webgksupport,项目名称:alpina,代码行数:101,代码来源:basketcompatibility.php

示例5: makeOrderArray

 /**
  * @param $siteId
  * @param null $userId
  * @param $shoppingCart
  * @param array $options
  *
  * @return array
  */
 static function makeOrderArray($siteId, $userId = null, array $shoppingCart, array $options = array())
 {
     // calculate weight for set parent
     $parentWeight = array();
     foreach ($shoppingCart as $item) {
         if (CSaleBasketHelper::isSetItem($item)) {
             $parentWeight[$item["SET_PARENT_ID"]]["WEIGHT"] += $item["WEIGHT"] * $item["QUANTITY"];
         }
     }
     foreach ($shoppingCart as &$item) {
         if (CSaleBasketHelper::isSetParent($item) && isset($parentWeight[$item["SET_PARENT_ID"]])) {
             $item["WEIGHT"] = $parentWeight[$item["SET_PARENT_ID"]]["WEIGHT"];
         }
     }
     unset($item);
     $currency = isset($options['CURRENCY']) && is_string($options['CURRENCY']) ? $options['CURRENCY'] : '';
     if ($currency === '') {
         $currency = CSaleLang::GetLangCurrency($siteId);
     }
     $arOrder = array("ORDER_PRICE" => 0, "ORDER_WEIGHT" => 0, "CURRENCY" => $currency, "WEIGHT_UNIT" => htmlspecialcharsbx(COption::GetOptionString('sale', 'weight_unit', false, $siteId)), "WEIGHT_KOEF" => htmlspecialcharsbx(COption::GetOptionString('sale', 'weight_koef', 1, $siteId)), "BASKET_ITEMS" => $shoppingCart, "SITE_ID" => $siteId, "LID" => $siteId, "USER_ID" => $userId, "USE_VAT" => false, "VAT_RATE" => 0, "VAT_SUM" => 0, "DELIVERY_ID" => false);
     if (isset($options["DELIVERY_EXTRA_SERVICES"])) {
         $arOrder["DELIVERY_EXTRA_SERVICES"] = $options["DELIVERY_EXTRA_SERVICES"];
     }
     $orderPrices = CSaleOrder::CalculateOrderPrices($shoppingCart);
     $arOrder['ORDER_PRICE'] = $orderPrices['ORDER_PRICE'];
     $arOrder['ORDER_WEIGHT'] = $orderPrices['ORDER_WEIGHT'];
     $arOrder['VAT_RATE'] = $orderPrices['VAT_RATE'];
     $arOrder['VAT_SUM'] = $orderPrices['VAT_SUM'];
     $arOrder["USE_VAT"] = $orderPrices['USE_VAT'] == "Y";
     return $arOrder;
 }
开发者ID:akniyev,项目名称:itprom_dobrohost,代码行数:39,代码来源:order.php

示例6: reSortItems

 /**
  * resorting of elements in the parent
  * @param $basketItems
  * @param bool $setIndexAsId
  * @return array
  */
 public static function reSortItems($basketItems, $setIndexAsId = false)
 {
     $basketItemsTmp = $basketItems;
     $parentItems = array();
     $parentItemFound = false;
     foreach ($basketItemsTmp as $basketItemKey => $basketItem) {
         if (CSaleBasketHelper::isSetParent($basketItem) || CSaleBasketHelper::isSetItem($basketItem)) {
             $parentItemFound = true;
             if (!array_key_exists($basketItem['SET_PARENT_ID'], $parentItems)) {
                 $parentItems[$basketItem['SET_PARENT_ID']] = array();
             }
             if (CSaleBasketHelper::isSetItem($basketItem)) {
                 $parentItems[$basketItem['SET_PARENT_ID']][] = $basketItem;
                 unset($basketItemsTmp[$basketItemKey]);
             }
         }
     }
     if ($parentItemFound === true && !empty($basketItemsTmp) && is_array($basketItemsTmp) && !empty($parentItems) && is_array($parentItems)) {
         $basketItems = array();
         foreach ($basketItemsTmp as $basketItem) {
             if ($setIndexAsId === true) {
                 $basketItems[$basketItem['ID']] = $basketItem;
             } else {
                 $basketItems[] = $basketItem;
             }
             if (array_key_exists($basketItem['ID'], $parentItems)) {
                 foreach ($parentItems[$basketItem['ID']] as $childItem) {
                     if ($setIndexAsId === true) {
                         $basketItems[$childItem['ID']] = $childItem;
                     } else {
                         $basketItems[] = $childItem;
                     }
                 }
             }
         }
     }
     return $basketItems;
 }
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:44,代码来源:basket_helper.php

示例7: OrderDeduction

 /**
  * Method is called to deduct all products of the order or undo deduction
  *
  * @param int $orderID
  * @param bool $bUndoDeduction
  * @param int $recurringID
  * @param bool $bAutoDeduction
  * @param array $arStoreBarcodeOrderFormData
  * @return mixed array
  */
 function OrderDeduction($orderID, $bUndoDeduction = false, $recurringID = 0, $bAutoDeduction = true, $arStoreBarcodeOrderFormData = array())
 {
     global $APPLICATION;
     static $storesCount = NULL;
     static $bAutoDeductionAllowed = NULL;
     $bRealDeductionAllowed = true;
     $defaultDeductionStore = 0;
     $arSavedStoreBarcodeData = array();
     $arItems = array();
     $arResult = array();
     if (defined("SALE_DEBUG") && SALE_DEBUG) {
         CSaleHelper::WriteToLog("OrderDeduction: started", array("orderID" => $orderID, "bUndoDeduction" => intval($bUndoDeduction), "bAutoDeduction" => intval($bAutoDeduction), "arStoreBarcodeOrderFormData" => $arStoreBarcodeOrderFormData), "OD1");
     }
     //TODO - recurringID - ?
     $orderID = IntVal($orderID);
     if ($orderID <= 0) {
         $arResult["RESULT"] = false;
         return $arResult;
     }
     $dbBasketList = CSaleBasket::GetList(array(), array("ORDER_ID" => $orderID), false, false, array('ID', 'LID', 'PRODUCT_ID', 'PRODUCT_PROVIDER_CLASS', 'MODULE', 'BARCODE_MULTI', 'QUANTITY', 'RESERVED', 'TYPE', 'SET_PARENT_ID'));
     //check basket items and emulate deduction
     while ($arBasket = $dbBasketList->Fetch()) {
         if (CSaleBasketHelper::isSetParent($arBasket)) {
             continue;
         }
         if (defined("SALE_DEBUG") && SALE_DEBUG) {
             CSaleHelper::WriteToLog("Deducting product #" . $arBasket["PRODUCT_ID"], array(), "OD2");
         }
         /** @var $productProvider IBXSaleProductProvider */
         if ($productProvider = CSaleBasket::GetProductProvider($arBasket)) {
             if (is_null($storesCount)) {
                 $storesCount = intval($productProvider::GetStoresCount(array("SITE_ID" => $arBasket["LID"])));
             }
             if (defined("SALE_DEBUG") && SALE_DEBUG) {
                 CSaleHelper::WriteToLog("stores count: " . $storesCount, array(), "OD3");
             }
             if (is_null($bAutoDeductionAllowed)) {
                 $defaultDeductionStore = COption::GetOptionString("sale", "deduct_store_id", "", $arBasket["LID"]);
                 if ($storesCount == 1 || $storesCount == -1 || intval($defaultDeductionStore) > 0) {
                     // if stores' count = 1 or stores aren't used or default deduction store is defined
                     $bAutoDeductionAllowed = true;
                 } else {
                     $bAutoDeductionAllowed = false;
                 }
             }
             if (defined("SALE_DEBUG") && SALE_DEBUG) {
                 CSaleHelper::WriteToLog("auto deduction allowed: " . intval($bAutoDeductionAllowed), array(), "OD4");
             }
             if ($bAutoDeduction && !$bAutoDeductionAllowed && !$bUndoDeduction) {
                 if (defined("SALE_DEBUG") && SALE_DEBUG) {
                     CSaleHelper::WriteToLog("DDCT_AUTO_DEDUCT_WRONG_STORES_QUANTITY", array(), "OD5");
                 }
                 $APPLICATION->ThrowException(Loc::getMessage("DDCT_AUTO_DEDUCT_WRONG_STORES_QUANTITY"), "DDCT_WRONG_STORES_QUANTITY");
                 $bRealDeductionAllowed = false;
             } else {
                 if ($bAutoDeduction && $arBasket["BARCODE_MULTI"] == "Y" && !$bUndoDeduction) {
                     if (defined("SALE_DEBUG") && SALE_DEBUG) {
                         CSaleHelper::WriteToLog("DDCT_AUTO_DEDUCT_BARCODE_MULTI", array(), "OD6");
                     }
                     $APPLICATION->ThrowException(Loc::getMessage("DDCT_AUTO_DEDUCT_BARCODE_MULTI", array("#PRODUCT_ID#" => $arBasket["PRODUCT_ID"])), "DDCT_CANT_DEDUCT_BARCODE_MULTI");
                     $bRealDeductionAllowed = false;
                 } else {
                     //get saved store & barcode data if stores are used to know where to return products
                     if ($bUndoDeduction && $storesCount > 0) {
                         $dbStoreBarcode = CSaleStoreBarcode::GetList(array(), array("BASKET_ID" => $arBasket["ID"]), false, false, array("ID", "BASKET_ID", "BARCODE", "QUANTITY", "STORE_ID"));
                         while ($arStoreBarcode = $dbStoreBarcode->Fetch()) {
                             $arSavedStoreBarcodeData[$arBasket["ID"]][] = $arStoreBarcode;
                         }
                         if (defined("SALE_DEBUG") && SALE_DEBUG) {
                             CSaleHelper::WriteToLog("OrderDeduction: CSaleStoreBarcode data (stores) to return products to", array("arSavedStoreBarcodeData" => $arSavedStoreBarcodeData), "OD7");
                         }
                     }
                     $arFields = array("PRODUCT_ID" => $arBasket["PRODUCT_ID"], "EMULATE" => "Y", "PRODUCT_RESERVED" => $arBasket["RESERVED"], "UNDO_DEDUCTION" => $bUndoDeduction ? "Y" : "N");
                     if ($bUndoDeduction) {
                         if ($storesCount > 0) {
                             $arFields["QUANTITY"] = 0;
                             //won't be used during deduction
                             $arFields["STORE_DATA"] = $arSavedStoreBarcodeData[$arBasket["ID"]];
                         } else {
                             $arFields["QUANTITY"] = $arBasket["QUANTITY"];
                             $arFields["STORE_DATA"] = array();
                         }
                     } else {
                         if ($storesCount == 1) {
                             $arFields["QUANTITY"] = 0;
                             if ($bAutoDeduction) {
                                 if ($arProductStore = $productProvider::GetProductStores(array("PRODUCT_ID" => $arBasket["PRODUCT_ID"], "SITE_ID" => $arBasket["LID"], 'BASKET_ID' => $arBasket['ID']))) {
                                     $arFields["STORE_DATA"] = array("0" => array("STORE_ID" => $arProductStore[0]["STORE_ID"], "QUANTITY" => $arBasket["QUANTITY"], "AMOUNT" => $arProductStore[0]["AMOUNT"]));
                                 } else {
                                     $arFields["STORE_DATA"] = array();
//.........这里部分代码省略.........
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:101,代码来源:basket.php

示例8: basket_items


//.........这里部分代码省略.........
					$arResult["VAT_SUM"] += roundEx($arItem["VAT_VALUE"] * $arItem["QUANTITY"], SALE_VALUE_PRECISION);
				}
				$arItem["PRICE_FORMATED"] = SaleFormatCurrency($arItem["PRICE"], $arItem["CURRENCY"]);
				$arItem["WEIGHT_FORMATED"] = roundEx(DoubleVal($arItem["WEIGHT"]/$arResult["WEIGHT_KOEF"]), SALE_WEIGHT_PRECISION)." ".$arResult["WEIGHT_UNIT"];

				if($arItem["DISCOUNT_PRICE"] > 0)
				{
					$arItem["DISCOUNT_PRICE_PERCENT"] = $arItem["DISCOUNT_PRICE"]*100 / ($arItem["DISCOUNT_PRICE"] + $arItem["PRICE"]);
					$arItem["DISCOUNT_PRICE_PERCENT_FORMATED"] = roundEx($arItem["DISCOUNT_PRICE_PERCENT"], 0)."%";
				}

				$arItem["PROPS"] = Array();
				$dbProp = CSaleBasket::GetPropsList(Array("SORT" => "ASC", "ID" => "ASC"), Array("BASKET_ID" => $arItem["ID"], "!CODE" => array("CATALOG.XML_ID", "PRODUCT.XML_ID")));
				while($arProp = $dbProp -> GetNext())
				{
					if (array_key_exists('BASKET_ID', $arProp))
					{
						unset($arProp['BASKET_ID']);
					}
					if (array_key_exists('~BASKET_ID', $arProp))
					{
						unset($arProp['~BASKET_ID']);
					}

					$arProp = array_filter($arProp, array("CSaleBasketHelper", "filterFields"));

					$arItem["PROPS"][] = $arProp;
				}

				if (!CSaleBasketHelper::isSetItem($arItem))
				{
					$DISCOUNT_PRICE_ALL += $arItem["DISCOUNT_PRICE"] * $arItem["QUANTITY"];
					$arItem["DISCOUNT_PRICE"] = roundEx($arItem["DISCOUNT_PRICE"], SALE_VALUE_PRECISION);
					$arResult["ORDER_PRICE"] += $arItem["PRICE"] * $arItem["QUANTITY"];
				}

				$arResult["ORDER_WEIGHT"] += $arItem["WEIGHT"] * $arItem["QUANTITY"];

				if (CSaleBasketHelper::isSetItem($arItem))
					$arSetParentWeight[$arItem["SET_PARENT_ID"]] += $arItem["WEIGHT"] * $arItem['QUANTITY'];

                //get product section
                $db_groups = CIBlockElement::GetElementGroups($arItem["PRODUCT_ID"], true);
                while($ar_group = $db_groups->Fetch())
                    $arItem["IBLOCK_SECTION_ID"][] = $ar_group["ID"];
                        
                if(!$arItem["IBLOCK_SECTION_ID"]){
                    $arItem["PARENT"] = CCatalogSku::GetProductInfo(
                        $arItem["PRODUCT_ID"]
                    );
                    
                    $db_groups = CIBlockElement::GetElementGroups($arItem["PARENT"]["ID"], true);
                    while($ar_group = $db_groups->Fetch())
                        $arItem["IBLOCK_SECTION_ID"][] = $ar_group["ID"];
                        
                } 
                if($arItem["IBLOCK_SECTION_ID"]){
                    foreach($arItem["IBLOCK_SECTION_ID"] as $section){
                        $res_1 = CIBlockSection::GetByID($section);
                        if($ar_res_1 = $res_1->GetNext()){
                            $arItem["SECTION_NAME"][] = $ar_res_1["NAME"];
                        }   
                    }
                }     
                
				$arResult["BASKET_ITEMS"][] = $arItem;
			}

			$arResult["PRICE_WITHOUT_DISCOUNT"] = SaleFormatCurrency($arResult["ORDER_PRICE"] + $DISCOUNT_PRICE_ALL, $allCurrency);

			// count weight for set parent products
			foreach ($arResult["BASKET_ITEMS"] as &$arItem)
			{
				if (CSaleBasketHelper::isSetParent($arItem))
				{
					$arItem["WEIGHT"] = $arSetParentWeight[$arItem["ID"]] / $arItem["QUANTITY"];
					$arItem["WEIGHT_FORMATED"] = roundEx(doubleval($arItem["WEIGHT"] / $arResult["WEIGHT_KOEF"]), SALE_WEIGHT_PRECISION)." ".$arResult["WEIGHT_UNIT"];
				}
			}

			$arResult["ORDER_WEIGHT_FORMATED"] = roundEx(DoubleVal($arResult["ORDER_WEIGHT"]/$arResult["WEIGHT_KOEF"]), SALE_WEIGHT_PRECISION)." ".$arResult["WEIGHT_UNIT"];
			$arResult["ORDER_PRICE_FORMATED"] = SaleFormatCurrency($arResult["ORDER_PRICE"], $arResult["BASE_LANG_CURRENCY"]);
			$arResult["VAT_SUM_FORMATED"] = SaleFormatCurrency($arResult["VAT_SUM"], $arResult["BASE_LANG_CURRENCY"]);

			$arElementId[] = $arItem["PRODUCT_ID"];

			if ($bUseCatalog)
			{
				$arParent = CCatalogSku::GetProductInfo($arItem["PRODUCT_ID"]);
				if ($arParent)
				{
					$arElementId[] = $arParent["ID"];
					$arSku2Parent[$arItem["PRODUCT_ID"]] = $arParent["ID"];
				}
			}
			unset($arItem);
		}
        
        return $arResult["BASKET_ITEMS"];
    }
开发者ID:ASDAFF,项目名称:gpbitrix,代码行数:101,代码来源:delivery_handler.php

示例9: Delete

 /**
  * <p>Метод удаляет запись корзины с кодом ID. Метод динамичный.</p> <a name="examples"></a>
  *
  *
  * @param int $ID  
  *
  * @return bool 
  *
  * <h4>Example</h4> 
  * <pre>
  * &lt;?
  * if (CSaleBasket::Delete(22))
  *     echo "Запись успешно удалена";
  * ?&gt;
  * </htmМетод может использоваться и для удаления записей корзин, которые уже превращены в заказы. То есть, мы можем удалить запись из состава заказа. Но следует помнить, что после использования метода необходимо обновлять итоговую сумму заказа, например, так: 
  * 
  * 
  *  $contents = array();
  *  $dbBasketItems = CSaleBasket::GetList(
  *             array(
  *                "NAME" =&gt; "ASC",
  *                "ID" =&gt; "ASC"
  *             ),
  *             array(
  *               "LID" =&gt; SITE_ID,
  *               "ORDER_ID" =&gt; $order_id,
  *             )
  *          );
  *   while ($arItems = $dbBasketItems-&gt;Fetch()){
  *             $contents[] = $arItems;
  *          }
  *   $sum = 0;
  *   foreach($contents as $basket_item){
  *             if($basket_item['DISCOUNT_PRICE']&gt;0){
  *                $sum += $basket_item['DISCOUNT_PRICE']*$basket_item['QUANTITY'];
  *             }else{
  *                $sum += $basket_item['PRICE']*$basket_item['QUANTITY'];
  *             }
  *          }
  *    $arFields = array(
  *             "PRICE" =&gt; $sum,
  *          );
  *    CSaleOrder::Update($order_id, $arFields);
  * </pre>
  *
  *
  * @static
  * @link http://dev.1c-bitrix.ru/api_help/sale/classes/csalebasket/csalebasket__delete.e0d06223.php
  * @author Bitrix
  */
 public static function Delete($ID)
 {
     global $DB, $APPLICATION;
     $isOrderConverted = \Bitrix\Main\Config\Option::get("main", "~sale_converted_15", 'N');
     $ID = intval($ID);
     if (0 >= $ID) {
         return false;
     }
     if ($isOrderConverted == "Y") {
         /** @var \Bitrix\Sale\Result $r */
         $r = \Bitrix\Sale\Compatible\BasketCompatibility::delete($ID);
         if (!$r->isSuccess(true)) {
             foreach ($r->getErrorMessages() as $error) {
                 $APPLICATION->ThrowException($error);
             }
             return false;
         }
         return true;
     }
     $rsBaskets = CSaleBasket::GetList(array(), array('ID' => $ID), false, false, array('ID', 'ORDER_ID', 'PRODUCT_ID', 'NAME', 'SUBSCRIBE', 'FUSER_ID', 'TYPE', 'SET_PARENT_ID'));
     if (!($arBasket = $rsBaskets->Fetch())) {
         return false;
     }
     foreach (GetModuleEvents("sale", "OnBeforeBasketDelete", true) as $arEvent) {
         if (ExecuteModuleEventEx($arEvent, array($ID)) === false) {
             return false;
         }
     }
     if (CSaleBasketHelper::isSetParent($arBasket)) {
         $rsSetItems = CSaleBasket::GetList(array(), array("SET_PARENT_ID" => $ID, "TYPE" => ""), false, false, array('ID', 'ORDER_ID', 'PRODUCT_ID', 'NAME', 'SUBSCRIBE', 'FUSER_ID', 'TYPE', 'SET_PARENT_ID'));
         while ($arSetItem = $rsSetItems->GetNext()) {
             CSaleBasket::Delete($arSetItem["ID"]);
         }
     }
     if (0 < intval($arBasket["ORDER_ID"])) {
         CSaleOrderChange::AddRecord($arBasket["ORDER_ID"], "BASKET_REMOVED", array("PRODUCT_ID" => $arBasket["PRODUCT_ID"], "NAME" => $arBasket["NAME"]));
     }
     $DB->Query("DELETE FROM b_sale_basket_props WHERE BASKET_ID = " . $ID, true);
     if (intval($_SESSION["SALE_BASKET_NUM_PRODUCTS"][SITE_ID]) > 0 && !CSaleBasketHelper::isSetItem($arBasket)) {
         $_SESSION["SALE_BASKET_NUM_PRODUCTS"][SITE_ID]--;
     }
     $DB->Query("DELETE FROM b_sale_store_barcode WHERE BASKET_ID = " . $ID, true);
     $DB->Query("DELETE FROM b_sale_basket WHERE ID = " . $ID, true);
     if ('Y' == $arBasket['SUBSCRIBE'] && array_key_exists('NOTIFY_PRODUCT', $_SESSION)) {
         $intUserID = CSaleUser::GetUserID($arBasket['FUSER_ID']);
         if ($intUserID && array_key_exists($intUserID, $_SESSION['NOTIFY_PRODUCT'])) {
             if (array_key_exists($arBasket['PRODUCT_ID'], $_SESSION['NOTIFY_PRODUCT'][$intUserID])) {
                 unset($_SESSION['NOTIFY_PRODUCT'][$intUserID][$arBasket['PRODUCT_ID']]);
             }
         }
//.........这里部分代码省略.........
开发者ID:andy-profi,项目名称:bxApiDocs,代码行数:101,代码来源:basket.php

示例10: GetMessage

         $status = GetMessage("BUYER_B_STATUS_DELAY");
     }
     if ($arBasket["CAN_BUY"] == "N" && $arBasket["SUBSCRIBE"] == "N") {
         $status = GetMessage("BUYER_B_STATUS_NO");
     }
     if ($arBasket["CAN_BUY"] == "N" && $arBasket["SUBSCRIBE"] == "Y") {
         $status = GetMessage("BUYER_B_STATUS_NOTIFY");
     }
     $row->AddField("DELAY", $status);
     $name = "<a href=\"" . $arBasket["DETAIL_PAGE_URL"] . "\">" . $arBasket["NAME"] . "</a>\n\t\t\t<input type=\"hidden\" value=\"" . $arBasket["PRODUCT_ID"] . "\" name=\"PRODUCT_ID[" . $arBasket["LID"] . "][]\" />";
     $name .= "<input type=\"hidden\" name=\"table_id\" value=\"" . $sTableID_tab4 . "\">";
     $dbProp = CSaleBasket::GetPropsList(array("SORT" => "ASC", "ID" => "ASC"), array("BASKET_ID" => $arBasket["ID"], "!CODE" => array("CATALOG.XML_ID", "PRODUCT.XML_ID")));
     while ($arProp = $dbProp->GetNext()) {
         $name .= "<div><small>" . $arProp["NAME"] . ": " . $arProp["VALUE"] . "</small></div>";
     }
     if (CSaleBasketHelper::isSetParent($arBasket)) {
         $name .= "<br/><a href=\"javascript:void(0);\" class=\"dashed-link show-set-link\" id=\"set_toggle_link_b2" . $arBasket["ID"] . "\" onclick=\"fToggleSetItems('b2" . $arBasket["ID"] . "', 'set_toggle_link_');\">" . GetMessage("BUYER_F_SHOW_SET") . "</a><br/>";
         if (!empty($arSetData) && array_key_exists($arBasket["ID"], $arSetData)) {
             $name .= "<div class=\"set_item_b2" . $arBasket["ID"] . "\" style=\"display:none\">";
             foreach ($arSetData[$arBasket["ID"]] as $set) {
                 $name .= "<p style=\"display:inline; font-style:italic\">" . $set["NAME"] . "</p><br/>";
             }
             $name .= "</div>";
         }
     }
     $row->AddField("NAME", $name);
     $row->AddField("PRICE", SaleFormatCurrency($arBasket["PRICE"], $arBasket["CURRENCY"]));
     if (count($arSites) > 1) {
         $row->AddField("LID", "[" . $arBasket["LID"] . "] " . htmlspecialcharsbx($arSites[$arBasket["LID"]]["NAME"]) . "");
     }
 }
开发者ID:akniyev,项目名称:itprom_dobrohost,代码行数:31,代码来源:buyers_profile.php

示例11: getBasketItems


//.........这里部分代码省略.........
             }
         }
         foreach ($arItem as $key => $value) {
             if (strpos($key, "PROPERTY_", 0) === 0 && strrpos($key, "_VALUE") == strlen($key) - 6) {
                 $code = str_replace(array("PROPERTY_", "_VALUE"), "", $key);
                 $propData = $this->arIblockProps[$code];
                 $arItem[$key] = CSaleHelper::getIblockPropInfo($value, $propData);
             }
         }
         $arItem["PREVIEW_PICTURE_SRC"] = "";
         if (isset($arItem["PREVIEW_PICTURE"]) && intval($arItem["PREVIEW_PICTURE"]) > 0) {
             $arImage = CFile::GetFileArray($arItem["PREVIEW_PICTURE"]);
             if ($arImage) {
                 $arFileTmp = CFile::ResizeImageGet($arImage, array("width" => "110", "height" => "110"), BX_RESIZE_IMAGE_PROPORTIONAL, true);
                 $arItem["PREVIEW_PICTURE_SRC"] = $arFileTmp["src"];
             }
         }
         $arItem["DETAIL_PICTURE_SRC"] = "";
         if (isset($arItem["DETAIL_PICTURE"]) && intval($arItem["DETAIL_PICTURE"]) > 0) {
             $arImage = CFile::GetFileArray($arItem["DETAIL_PICTURE"]);
             if ($arImage) {
                 $arFileTmp = CFile::ResizeImageGet($arImage, array("width" => "110", "height" => "110"), BX_RESIZE_IMAGE_PROPORTIONAL, true);
                 $arItem["DETAIL_PICTURE_SRC"] = $arFileTmp["src"];
             }
         }
     }
     unset($arItem);
     // get sku props data
     if (!empty($arBasketItems) && $bUseCatalog && isset($this->offersProps) && !empty($this->offersProps)) {
         $arBasketItems = $this->getSkuPropsData($arBasketItems, $arParents, $this->offersProps);
     }
     // count weight for set parent products
     foreach ($arBasketItems as &$arItem) {
         if (CSaleBasketHelper::isSetParent($arItem)) {
             $arItem["WEIGHT"] = $arSetParentWeight[$arItem["ID"]] / $arItem["QUANTITY"];
             $arItem["WEIGHT_FORMATED"] = roundEx(doubleval($arItem["WEIGHT"] / $this->weightKoef), SALE_WEIGHT_PRECISION) . " " . $this->weightUnit;
         }
     }
     if (isset($arItem)) {
         unset($arItem);
     }
     // fill item arrays for old templates
     foreach ($arBasketItems as &$arItem) {
         if (CSaleBasketHelper::isSetItem($arItem)) {
             continue;
         }
         if ($arItem["CAN_BUY"] == "Y" && $arItem["DELAY"] == "N") {
             $allSum += $arItem["PRICE"] * $arItem["QUANTITY"];
             $allWeight += $arItem["WEIGHT"] * $arItem["QUANTITY"];
             $allVATSum += roundEx($arItem["PRICE_VAT_VALUE"] * $arItem["QUANTITY"], SALE_VALUE_PRECISION);
             $bShowReady = True;
             if (doubleval($arItem["DISCOUNT_PRICE"]) > 0) {
                 if (0 < doubleval($arItem["DISCOUNT_PRICE"] + $arItem["PRICE"])) {
                     $arItem["DISCOUNT_PRICE_PERCENT"] = $arItem["DISCOUNT_PRICE"] * 100 / ($arItem["DISCOUNT_PRICE"] + $arItem["PRICE"]);
                 } else {
                     $arItem["DISCOUNT_PRICE_PERCENT"] = 0;
                 }
                 $arItem["DISCOUNT_PRICE_PERCENT_FORMATED"] = roundEx($arItem["DISCOUNT_PRICE_PERCENT"], SALE_VALUE_PRECISION) . "%";
                 $DISCOUNT_PRICE_ALL += $arItem["DISCOUNT_PRICE"] * $arItem["QUANTITY"];
             }
             $arResult["ITEMS"]["AnDelCanBuy"][] = $arItem;
         } elseif ($arItem["CAN_BUY"] == "Y" && $arItem["DELAY"] == "Y") {
             $bShowDelay = True;
             $arResult["ITEMS"]["DelDelCanBuy"][] = $arItem;
         } elseif ($arItem["CAN_BUY"] == "N" && $arItem["SUBSCRIBE"] == "Y") {
             $bShowSubscribe = True;
开发者ID:akniyev,项目名称:itprom_dobrohost,代码行数:67,代码来源:class.php

示例12: getBasketItems


//.........这里部分代码省略.........

					$arItem["PREVIEW_PICTURE_SRC"] = $arFileTmp["src"];
				}
			}

			$arItem["DETAIL_PICTURE_SRC"] = "";
			if (isset($arItem["DETAIL_PICTURE"]) && intval($arItem["DETAIL_PICTURE"]) > 0)
			{
				$arImage = CFile::GetFileArray($arItem["DETAIL_PICTURE"]);
				if ($arImage)
				{
					$arFileTmp = CFile::ResizeImageGet(
						$arImage,
						array("width" => "110", "height" =>"110"),
						BX_RESIZE_IMAGE_PROPORTIONAL,
						true
					);

					$arItem["DETAIL_PICTURE_SRC"] = $arFileTmp["src"];
				}
			}
		}
		unset($arItem);

		// get sku props data
		if (!empty($arBasketItems) && $bUseCatalog && isset($this->offersProps) && !empty($this->offersProps))
		{
			$arBasketItems = $this->getSkuPropsData($arBasketItems, $arParents, $this->offersProps);
		}

		// count weight for set parent products
		foreach ($arBasketItems as &$arItem)
		{
			if (CSaleBasketHelper::isSetParent($arItem))
			{
				$arItem["WEIGHT"] = $arSetParentWeight[$arItem["ID"]] / $arItem["QUANTITY"];
				$arItem["WEIGHT_FORMATED"] = roundEx(doubleval($arItem["WEIGHT"] / $this->weightKoef), SALE_WEIGHT_PRECISION)." ".$this->weightUnit;
			}
		}

		if (isset($arItem))
		{
			unset($arItem);
		}
		// fill item arrays for old templates
		foreach ($arBasketItems as &$arItem)
		{
			if (CSaleBasketHelper::isSetItem($arItem))
				continue;

			if ($arItem["CAN_BUY"] == "Y" && $arItem["DELAY"] == "N")
			{
				$allSum += ($arItem["PRICE"] * $arItem["QUANTITY"]);
				$allWeight += ($arItem["WEIGHT"] * $arItem["QUANTITY"]);
				$allVATSum += roundEx($arItem["PRICE_VAT_VALUE"] * $arItem["QUANTITY"], SALE_VALUE_PRECISION);

				$bShowReady = True;
				if(doubleval($arItem["DISCOUNT_PRICE"]) > 0)
				{
					if (0 < doubleval($arItem["DISCOUNT_PRICE"] + $arItem["PRICE"]))
					{
						$arItem["DISCOUNT_PRICE_PERCENT"] = $arItem["DISCOUNT_PRICE"]*100 / ($arItem["DISCOUNT_PRICE"] + $arItem["PRICE"]);
					}
					else
					{
						$arItem["DISCOUNT_PRICE_PERCENT"] = 0;
开发者ID:ASDAFF,项目名称:entask.ru,代码行数:67,代码来源:class.php

示例13: Delete

 function Delete($ID)
 {
     global $DB;
     $ID = intval($ID);
     if (0 >= $ID) {
         return false;
     }
     $rsBaskets = CSaleBasket::GetList(array(), array('ID' => $ID), false, false, array('ID', 'ORDER_ID', 'PRODUCT_ID', 'NAME', 'SUBSCRIBE', 'FUSER_ID', 'TYPE', 'SET_PARENT_ID'));
     if (!($arBasket = $rsBaskets->Fetch())) {
         return false;
     }
     foreach (GetModuleEvents("sale", "OnBeforeBasketDelete", true) as $arEvent) {
         if (ExecuteModuleEventEx($arEvent, array($ID)) === false) {
             return false;
         }
     }
     if (CSaleBasketHelper::isSetParent($arBasket)) {
         $rsSetItems = CSaleBasket::GetList(array(), array("SET_PARENT_ID" => $ID, "TYPE" => ""), false, false, array('ID', 'ORDER_ID', 'PRODUCT_ID', 'NAME', 'SUBSCRIBE', 'FUSER_ID', 'TYPE', 'SET_PARENT_ID'));
         while ($arSetItem = $rsSetItems->GetNext()) {
             CSaleBasket::Delete($arSetItem["ID"]);
         }
     }
     if (0 < intval($arBasket["ORDER_ID"])) {
         CSaleOrderChange::AddRecord($arBasket["ORDER_ID"], "BASKET_REMOVED", array("PRODUCT_ID" => $arBasket["PRODUCT_ID"], "NAME" => $arBasket["NAME"]));
     }
     $DB->Query("DELETE FROM b_sale_basket_props WHERE BASKET_ID = " . $ID, true);
     if (intval($_SESSION["SALE_BASKET_NUM_PRODUCTS"][SITE_ID]) > 0 && !CSaleBasketHelper::isSetItem($arBasket)) {
         $_SESSION["SALE_BASKET_NUM_PRODUCTS"][SITE_ID]--;
     }
     $DB->Query("DELETE FROM b_sale_store_barcode WHERE BASKET_ID = " . $ID, true);
     $DB->Query("DELETE FROM b_sale_basket WHERE ID = " . $ID, true);
     if ('Y' == $arBasket['SUBSCRIBE'] && array_key_exists('NOTIFY_PRODUCT', $_SESSION)) {
         $intUserID = CSaleUser::GetUserID($arBasket['FUSER_ID']);
         if ($intUserID && array_key_exists($intUserID, $_SESSION['NOTIFY_PRODUCT'])) {
             if (array_key_exists($arBasket['PRODUCT_ID'], $_SESSION['NOTIFY_PRODUCT'][$intUserID])) {
                 unset($_SESSION['NOTIFY_PRODUCT'][$intUserID][$arBasket['PRODUCT_ID']]);
             }
         }
     }
     foreach (GetModuleEvents("sale", "OnBasketDelete", true) as $arEvent) {
         ExecuteModuleEventEx($arEvent, array($ID));
     }
     return true;
 }
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:44,代码来源:basket.php

示例14: obtainBasket

 /**
  * Function gets order basket info from the database
  * @param mixed[] Cached data taken from obtainDataCachedStructure()
  * @return void
  */
 protected function obtainBasket(&$cached)
 {
     if (empty($this->dbResult["ID"])) {
         return;
     }
     $basket = array();
     $arSetParentWeight = array();
     $dbBasket = CSaleBasket::GetList(array("NAME" => "ASC"), array("ORDER_ID" => $this->dbResult["ID"]), false, false, array("ID", "DETAIL_PAGE_URL", "NAME", "NOTES", "QUANTITY", "PRICE", "CURRENCY", "PRODUCT_ID", "DISCOUNT_PRICE", "WEIGHT", "CATALOG_XML_ID", "VAT_RATE", "PRODUCT_XML_ID", "TYPE", "SET_PARENT_ID", "MEASURE_CODE", "MEASURE_NAME", "MODULE"));
     while ($arItem = $dbBasket->Fetch()) {
         if (CSaleBasketHelper::isSetItem($arItem)) {
             continue;
         }
         if ($this->useCatalog && $this->cameFromCatalog($arItem)) {
             $arParent = CCatalogSku::GetProductInfo($arItem["PRODUCT_ID"]);
             if (!empty($arParent)) {
                 $arItem['PARENT'] = $arParent;
             }
         }
         // adjust some sale params
         $arItem["PRICE_VAT_VALUE"] = $arItem["PRICE"] / ($arItem["VAT_RATE"] + 1) * $arItem["VAT_RATE"];
         $arItem["WEIGHT"] = doubleval($arItem["WEIGHT"]);
         // weight manipulation for product that has type "SET" (nabor)
         if (CSaleBasketHelper::isSetItem($arItem)) {
             $arSetParentWeight[$arItem["SET_PARENT_ID"]] += $arItem["WEIGHT"] * $arItem["QUANTITY"];
         }
         if (CSaleBasketHelper::isSetParent($arItem)) {
             $arItem["WEIGHT"] = $arSetParentWeight[$arItem["ID"]] / $arItem["QUANTITY"];
         }
         $basket[] = $arItem;
     }
     // fetching all properties
     $this->obtainBasketProps($basket);
     $cached["BASKET"] = $basket;
 }
开发者ID:akniyev,项目名称:itprom_dobrohost,代码行数:39,代码来源:class.php

示例15: DoCalculateOrder

	/**
	 * @param $siteId
	 * @param $userId
	 * @param $arShoppingCart
	 * @param $personTypeId
	 * @param $arOrderPropsValues
	 * @param $deliveryId
	 * @param $paySystemId
	 * @param $arOptions
	 * @param $arErrors
	 * @param $arWarnings
	 * @return array|null
	 */
	static function DoCalculateOrder($siteId, $userId, $arShoppingCart, $personTypeId, $arOrderPropsValues,
		$deliveryId, $paySystemId, $arOptions, &$arErrors, &$arWarnings)
	{
		if(!is_array($arOptions))
		{
			$arOptions = array();
		}

		$siteId = trim($siteId);
		if (empty($siteId))
		{
			$arErrors[] = array("CODE" => "PARAM", "TEXT" => GetMessage('SKGO_CALC_PARAM_ERROR'));
			return null;
		}

		$userId = intval($userId);

		if (!is_array($arShoppingCart) || (count($arShoppingCart) <= 0))
		{
			$arErrors[] = array("CODE" => "PARAM", "TEXT" => GetMessage('SKGO_SHOPPING_CART_EMPTY'));
			return null;
		}

		// calculate weight for set parent
		$arParentWeight = array();
		foreach ($arShoppingCart as $arItem)
		{
			if (CSaleBasketHelper::isSetItem($arItem))
				$arParentWeight[$arItem["SET_PARENT_ID"]]["WEIGHT"] += $arItem["WEIGHT"] * $arItem["QUANTITY"];
		}

		foreach ($arShoppingCart as &$arItem)
		{
			if (CSaleBasketHelper::isSetParent($arItem) && isset($arParentWeight[$arItem["SET_PARENT_ID"]]))
				$arItem["WEIGHT"] = $arParentWeight[$arItem["SET_PARENT_ID"]]["WEIGHT"];
		}
		unset($arItem);

		$currency = isset($arOptions['CURRENCY']) && is_string($arOptions['CURRENCY']) ? $arOptions['CURRENCY'] : '';
		if($currency === '')
		{
			$currency = CSaleLang::GetLangCurrency($siteId);
		}

		$arOrder = array(
			"ORDER_PRICE" => 0,
			"ORDER_WEIGHT" => 0,
			"CURRENCY" => $currency,
			"WEIGHT_UNIT" => htmlspecialcharsbx(COption::GetOptionString('sale', 'weight_unit', false, $siteId)),
			"WEIGHT_KOEF" => htmlspecialcharsbx(COption::GetOptionString('sale', 'weight_koef', 1, $siteId)),
			"BASKET_ITEMS" => $arShoppingCart,
			"SITE_ID" => $siteId,
			"LID" => $siteId,
			"USER_ID" => $userId,
			"USE_VAT" => false,
			"VAT_RATE" => 0,
			"VAT_SUM" => 0,
			"DELIVERY_ID" => false,
		);

		$arOrderPrices = CSaleOrder::CalculateOrderPrices($arShoppingCart);

		if (sizeof($arOrderPrices)>0 && isset($arOrderPrices['BASKET_ITEMS']))
			$arShoppingCart = $arOrderPrices['BASKET_ITEMS'];

		$arOrder['ORDER_PRICE'] = $arOrderPrices['ORDER_PRICE'];
		$arOrder['ORDER_WEIGHT'] = $arOrderPrices['ORDER_WEIGHT'];
		$arOrder['VAT_RATE'] = $arOrderPrices['VAT_RATE'];
		$arOrder['VAT_SUM'] = $arOrderPrices['VAT_SUM'];
		$arOrder["USE_VAT"] = ($arOrderPrices['USE_VAT'] == "Y"?true:false);

		foreach(GetModuleEvents("sale", "OnSaleCalculateOrderShoppingCart", true) as $arEvent)
			ExecuteModuleEventEx($arEvent, array(&$arOrder));

		CSalePersonType::DoProcessOrder($arOrder, $personTypeId, $arErrors);
		if (count($arErrors) > 0)
			return null;

		foreach(GetModuleEvents("sale", "OnSaleCalculateOrderPersonType", true) as $arEvent)
			ExecuteModuleEventEx($arEvent, array(&$arOrder));

		CSaleOrderProps::DoProcessOrder($arOrder, $arOrderPropsValues, $arErrors, $arWarnings, $paySystemId, $deliveryId);
		if (count($arErrors) > 0)
			return null;

		foreach(GetModuleEvents("sale", "OnSaleCalculateOrderProps", true) as $arEvent)
			ExecuteModuleEventEx($arEvent, array(&$arOrder));
//.........这里部分代码省略.........
开发者ID:ASDAFF,项目名称:entask.ru,代码行数:101,代码来源:order.php


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