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


PHP CSaleBasket::UpdateBasketPrices方法代码示例

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


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

示例1: getBasketItems

 public function getBasketItems()
 {
     global $APPLICATION;
     if (self::$catalogIncluded === null) {
         self::$catalogIncluded = Loader::includeModule('catalog');
     }
     self::$iblockIncluded = self::$catalogIncluded;
     CSaleBasket::UpdateBasketPrices(CSaleBasket::GetBasketUserID(), SITE_ID);
     $bShowReady = false;
     $bShowDelay = false;
     $bShowSubscribe = false;
     $bShowNotAvail = false;
     $allSum = 0;
     $allWeight = 0;
     $allCurrency = CSaleLang::GetLangCurrency(SITE_ID);
     $allVATSum = 0;
     $arParents = array();
     $arResult["ITEMS"]["AnDelCanBuy"] = array();
     $arResult["ITEMS"]["DelDelCanBuy"] = array();
     $arResult["ITEMS"]["nAnCanBuy"] = array();
     $arResult["ITEMS"]["ProdSubscribe"] = array();
     $DISCOUNT_PRICE_ALL = 0;
     // BASKET PRODUCTS (including measures, ratio, iblock properties data)
     $arImgFields = array("PREVIEW_PICTURE", "DETAIL_PICTURE");
     $arBasketItems = array();
     $basketKey = 0;
     $basketIds = array();
     $arSku2Parent = array();
     $arSetParentWeight = array();
     $arElementId = array();
     $dbItems = CSaleBasket::GetList(array("ID" => "ASC"), array("FUSER_ID" => CSaleBasket::GetBasketUserID(), "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 = $dbItems->GetNext()) {
         $arItem['PROPS'] = array();
         $arBasketItems[$basketKey] = $arItem;
         $basketIds[$arItem['ID']] =& $arBasketItems[$basketKey];
         $basketKey++;
         if (CSaleBasketHelper::isSetItem($arItem)) {
             continue;
         }
         $arElementId[] = $arItem["PRODUCT_ID"];
     }
     if (!empty($arElementId) && self::$catalogIncluded) {
         $productList = CCatalogSKU::getProductList($arElementId);
         if (!empty($productList)) {
             foreach ($productList as $offerId => $offerInfo) {
                 $offerInfo['PRODUCT_ID'] = $offerInfo['ID'];
                 $arElementId[] = $offerInfo['ID'];
                 $arSku2Parent[$offerId] = $offerInfo['ID'];
                 $arParents[$offerId] = $offerInfo;
             }
             unset($offerInfo, $offerId);
         }
         unset($productList);
         // get measures, ratio, sku props data and available quantity
         $arBasketItems = getMeasures($arBasketItems);
         $arBasketItems = getRatio($arBasketItems);
         $arBasketItems = $this->getAvailableQuantity($arBasketItems);
         $propsIterator = CSaleBasket::GetPropsList(array('BASKET_ID' => 'ASC', 'SORT' => 'ASC', 'ID' => 'ASC'), array('BASKET_ID' => array_keys($basketIds)));
         while ($property = $propsIterator->GetNext()) {
             $property['CODE'] = (string) $property['CODE'];
             if ($property['CODE'] == 'CATALOG.XML_ID' || $property['CODE'] == 'PRODUCT.XML_ID') {
                 continue;
             }
             if (!isset($basketIds[$property['BASKET_ID']])) {
                 continue;
             }
             $basketIds[$property['BASKET_ID']]['PROPS'][] = $property;
         }
         unset($property, $propsIterator, $basketIds);
     }
     // get product properties data
     $arProductData = getProductProps($arElementId, array_merge(array("ID"), $arImgFields, $this->arCustomSelectFields));
     foreach ($arBasketItems as &$arItem) {
         $quantityIsFloat = false;
         if (number_format(doubleval($arItem['QUANTITY']), 2, '.', '') != intval($arItem['QUANTITY'])) {
             $quantityIsFloat = true;
         }
         $arItem["QUANTITY"] = $quantityIsFloat === false && $this->quantityFloat != "Y" ? intval($arItem['QUANTITY']) : number_format(doubleval($arItem['QUANTITY']), 2, '.', '');
         $arItem["PRICE_VAT_VALUE"] = $arItem["PRICE"] / ($arItem["VAT_RATE"] + 1) * $arItem["VAT_RATE"];
         $arItem["PRICE_FORMATED"] = CCurrencyLang::CurrencyFormat($arItem["PRICE"], $arItem["CURRENCY"], true);
         $arItem["WEIGHT"] = doubleval($arItem["WEIGHT"]);
         $arItem["WEIGHT_FORMATED"] = roundEx(doubleval($arItem["WEIGHT"] / $this->weightKoef), SALE_WEIGHT_PRECISION) . " " . $this->weightUnit;
         if (CSaleBasketHelper::isSetItem($arItem)) {
             $arSetParentWeight[$arItem["SET_PARENT_ID"]] += $arItem["WEIGHT"] * $arItem["QUANTITY"];
         }
         if (isset($arProductData[$arItem['PRODUCT_ID']]) && is_array($arProductData[$arItem['PRODUCT_ID']])) {
             foreach ($arProductData[$arItem["PRODUCT_ID"]] as $key => $value) {
                 if (strpos($key, "PROPERTY_") !== false || in_array($key, $arImgFields)) {
                     $arItem[$key] = $value;
                 }
             }
         }
         if (array_key_exists($arItem["PRODUCT_ID"], $arSku2Parent)) {
             $arFieldsToFill = array_merge($this->arCustomSelectFields, $arImgFields);
             // fields to be filled with parents' values if empty
             foreach ($arFieldsToFill as $field) {
                 $fieldVal = in_array($field, $arImgFields) ? $field : $field . "_VALUE";
                 $parentId = $arSku2Parent[$arItem["PRODUCT_ID"]];
                 if ((!isset($arItem[$fieldVal]) || isset($arItem[$fieldVal]) && strlen($arItem[$fieldVal]) == 0) && (isset($arProductData[$parentId][$fieldVal]) && !empty($arProductData[$parentId][$fieldVal]))) {
                     $arItem[$fieldVal] = $arProductData[$parentId][$fieldVal];
//.........这里部分代码省略.........
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:101,代码来源:class.php

示例2: LocalRedirect

             LocalRedirect($APPLICATION->GetCurPageParam("ORDER_ID=" . $ORDER_ID . $urlError, array("ORDER_ID", "action", "id")));
         } elseif (!empty($arErrors)) {
             foreach ($arErrors as $val) {
                 $errorMessage .= $val . "<br>";
             }
         }
     }
 } else {
     if (!isset($_POST["BasketOrder"])) {
         $errorMessage = "";
     }
 }
 /*********************************************************/
 /******************** take basket ************************/
 /*********************************************************/
 CSaleBasket::UpdateBasketPrices(CSaleBasket::GetBasketUserID(), SITE_ID);
 $dbDelayBasketItems = CSaleBasket::GetList(array("ID" => "ASC"), array("FUSER_ID" => CSaleBasket::GetBasketUserID(), "LID" => SITE_ID, "ORDER_ID" => "NULL"), false, false, array("*"));
 $arBasketItems["BASKET_ITEMS"] = array();
 $arSetParentWeight = array();
 while ($arItems = $dbDelayBasketItems->GetNext()) {
     $arItems['QUANTITY'] = $arParams['QUANTITY_FLOAT'] == 'Y' ? number_format(DoubleVal($arItems['QUANTITY']), 2, '.', '') : intval($arItems['QUANTITY']);
     $arBasketItems["BASKET_ITEMS"][] = $arItems;
     if (CSaleBasketHelper::isSetItem($arItems)) {
         $arSetParentWeight[$arItems["SET_PARENT_ID"]] += $arItems["WEIGHT"] * $arItems['QUANTITY'];
     }
 }
 // count weight for set parent products
 foreach ($arBasketItems["BASKET_ITEMS"] as &$arItems) {
     if (CSaleBasketHelper::isSetParent($arItems)) {
         $arItems["WEIGHT"] = $arSetParentWeight[$arItems["ID"]] / $arItems["QUANTITY"];
     }
开发者ID:webgksupport,项目名称:alpina,代码行数:31,代码来源:component.php

示例3: array

     }
 }
 if (strlen(trim($basket_name_product)) > 0) {
     $arBasketFilter["%NAME"] = $basket_name_product;
 }
 CAdminMessage::ShowNote($basketMessage);
 CAdminMessage::ShowMessage($basketError);
 //update price
 $arCacheFuser = array();
 $arUpdateFilter = $arBasketFilter;
 $arUpdateFilter["!CALLBACK_FUNC"] = '';
 $dbBasketList = \Bitrix\Sale\Internals\BasketTable::getList(array('order' => $arBasketSort, 'filter' => $arUpdateFilter, 'select' => array('FUSER_ID', 'LID')));
 while ($arBasket = $dbBasketList->fetch()) {
     if (!in_array($arBasket["FUSER_ID"], $arCacheFuser)) {
         $arCacheFuser[] = $arBasket["FUSER_ID"];
         CSaleBasket::UpdateBasketPrices($arBasket["FUSER_ID"], $arBasket["LID"]);
     }
 }
 $dbBasketList = \Bitrix\Sale\Internals\BasketTable::getList(array('order' => array_merge(array("SET_PARENT_ID" => "DESC", "TYPE" => "DESC"), $arBasketSort), 'filter' => $arBasketFilter));
 $dbBasketList = new CAdminResult($dbBasketList, $sTableID_tab4);
 $dbBasketList->NavStart();
 $lAdmin_tab4->NavText($dbBasketList->GetNavPrint(GetMessage('BUYER_BASKET_BASKET')));
 $BasketHeader = array(array("id" => "DATE_INSERT", "content" => GetMessage("BUYER_BH_DATE_INSERT"), "sort" => "DATE_INSERT", "default" => true), array("id" => "NAME", "content" => GetMessage("BUYER_BH_NAME"), "sort" => "NAME", "default" => true), array("id" => "DELAY", "content" => GetMessage("BUYER_BH_DELAY"), "sort" => "DELAY", "default" => true), array("id" => "PRICE", "content" => GetMessage("BUYER_BH_PRICE"), "sort" => "PRICE", "default" => true), array("id" => "QUANTITY", "content" => GetMessage("BUYER_BH_QUANTITY"), "sort" => "QUANTITY", "default" => true));
 if (count($arSites) > 1) {
     $BasketHeader[] = array("id" => "LID", "content" => GetMessage("BUYER_BH_LID"), "sort" => "LID", "default" => true);
 }
 $lAdmin_tab4->AddHeaders($BasketHeader);
 $arSetData = array();
 $arBasketData = array();
 while ($arBasket = $dbBasketList->GetNext()) {
     if (CSaleBasketHelper::isSetItem($arBasket)) {
开发者ID:akniyev,项目名称:itprom_dobrohost,代码行数:31,代码来源:buyers_profile.php

示例4: basket_items

    private function basket_items() {
        CModule::IncludeModule("iblock");
        CModule::IncludeModule("sale");
        
        CSaleBasket::UpdateBasketPrices(CSaleBasket::GetBasketUserID(), SITE_ID);
		/* Check Values Begin */

		$arSelFields = array("ID", "CALLBACK_FUNC", "MODULE", "PRODUCT_ID", "QUANTITY", "DELAY",
			"CAN_BUY", "PRICE", "WEIGHT", "NAME", "CURRENCY", "CATALOG_XML_ID", "VAT_RATE",
			"NOTES", "DISCOUNT_PRICE", "PRODUCT_PROVIDER_CLASS", "DIMENSIONS", "TYPE", "SET_PARENT_ID", "DETAIL_PAGE_URL"
		);
		$dbBasketItems = CSaleBasket::GetList(
				array("ID" => "ASC"),
				array(
						"FUSER_ID" => CSaleBasket::GetBasketUserID(),
						"LID" => SITE_ID,
						"ORDER_ID" => "NULL"
					),
				false,
				false,
				$arSelFields
			);
		while ($arItem = $dbBasketItems->GetNext())
		{
			if ($arItem["DELAY"] == "N" && $arItem["CAN_BUY"] == "Y")
			{
				$arItem["PRICE"] = roundEx($arItem["PRICE"], SALE_VALUE_PRECISION);
				$arItem["QUANTITY"] = DoubleVal($arItem["QUANTITY"]);

				$arItem["WEIGHT"] = DoubleVal($arItem["WEIGHT"]);
				$arItem["VAT_RATE"] = DoubleVal($arItem["VAT_RATE"]);

				$arDim = unserialize($arItem["~DIMENSIONS"]);

				if(is_array($arDim))
				{
					$arItem["DIMENSIONS"] = $arDim;
					unset($arItem["~DIMENSIONS"]);

					$arResult["MAX_DIMENSIONS"] = CSaleDeliveryHelper::getMaxDimensions(
                        array(
					       $arDim["WIDTH"],
					       $arDim["HEIGHT"],
					       $arDim["LENGTH"]
					    ),
		            $arResult["MAX_DIMENSIONS"]);

					$arResult["ITEMS_DIMENSIONS"][] = $arDim;
				}

				if($arItem["VAT_RATE"] > 0 && !CSaleBasketHelper::isSetItem($arItem))
				{
					$arResult["bUsingVat"] = "Y";
					if($arItem["VAT_RATE"] > $arResult["VAT_RATE"])
						$arResult["VAT_RATE"] = $arItem["VAT_RATE"];
					//$arItem["VAT_VALUE"] = roundEx((($arItem["PRICE"] / ($arItem["VAT_RATE"] +1)) * $arItem["VAT_RATE"]), SALE_VALUE_PRECISION);
					$arItem["VAT_VALUE"] = (($arItem["PRICE"] / ($arItem["VAT_RATE"] +1)) * $arItem["VAT_RATE"]);

					$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
//.........这里部分代码省略.........
开发者ID:ASDAFF,项目名称:gpbitrix,代码行数:101,代码来源:delivery_handler.php

示例5: getBasketItems

	public function getBasketItems()
	{
		global $APPLICATION;
		$bUseCatalog = CModule::IncludeModule("catalog");
		$bUseIblock = $bUseCatalog;

		CSaleBasket::UpdateBasketPrices(CSaleBasket::GetBasketUserID(), SITE_ID);

		$bShowReady = False;
		$bShowDelay = False;
		$bShowSubscribe = False;
		$bShowNotAvail = False;
		$allSum = 0;
		$allWeight = 0;
		$allCurrency = CSaleLang::GetLangCurrency(SITE_ID);
		$allVATSum = 0;
		$arParents = array();

		$arResult["ITEMS"]["AnDelCanBuy"] = array();
		$arResult["ITEMS"]["DelDelCanBuy"] = array();
		$arResult["ITEMS"]["nAnCanBuy"] = array();
		$arResult["ITEMS"]["ProdSubscribe"] = array();
		$DISCOUNT_PRICE_ALL = 0;

		// BASKET PRODUCTS (including measures, ratio, iblock properties data)

		$arImgFields = array("PREVIEW_PICTURE", "DETAIL_PICTURE");
		$arBasketItems = array();
		$arSku2Parent = array();
		$arSetParentWeight = array();
		$dbItems = CSaleBasket::GetList(
			array("ID" => "ASC"),
			array(
				"FUSER_ID" => CSaleBasket::GetBasketUserID(),
				"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 = $dbItems->GetNext())
		{
			$arBasketItems[] = $arItem;

			if (CSaleBasketHelper::isSetItem($arItem))
				continue;

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

			if ($bUseCatalog)
			{
				$arParent = CCatalogSku::GetProductInfo($arItem["PRODUCT_ID"]);

				if ($arParent)
				{
					$arElementId[] = $arParent["ID"];
					$arSku2Parent[$arItem["PRODUCT_ID"]] = $arParent["ID"];

					$arParents[$arItem["PRODUCT_ID"]]["PRODUCT_ID"] = $arParent["ID"];
					$arParents[$arItem["PRODUCT_ID"]]["IBLOCK_ID"] = $arParent["IBLOCK_ID"];
				}
			}
		}

		// get measures, ratio, sku props data and available quantity
		if (!empty($arBasketItems) && $bUseCatalog)
		{
			$arBasketItems = getMeasures($arBasketItems);
			$arBasketItems = getRatio($arBasketItems);
			$arBasketItems = $this->getAvailableQuantity($arBasketItems);
		}

		// get product properties data
		$arProductData = getProductProps($arElementId, array_merge(array("ID"), $arImgFields, $this->arCustomSelectFields));

		foreach ($arBasketItems as &$arItem)
		{

			$quantityIsFloat = false;
			if (number_format(doubleval($arItem['QUANTITY']), 2, '.', '') != intval($arItem['QUANTITY']))
			{
				$quantityIsFloat = true;
			}

			$arItem["QUANTITY"] = ($quantityIsFloat === false && $this->quantityFloat != "Y") ? intval($arItem['QUANTITY']) : number_format(doubleval($arItem['QUANTITY']), 2, '.', '');

			$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())
				$arItem["PROPS"][] = $arProp;

//.........这里部分代码省略.........
开发者ID:ASDAFF,项目名称:entask.ru,代码行数:101,代码来源:class.php


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