當前位置: 首頁>>代碼示例>>PHP>>正文


PHP CSaleBasket::GetList方法代碼示例

本文整理匯總了PHP中CSaleBasket::GetList方法的典型用法代碼示例。如果您正苦於以下問題:PHP CSaleBasket::GetList方法的具體用法?PHP CSaleBasket::GetList怎麽用?PHP CSaleBasket::GetList使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在CSaleBasket的用法示例。


在下文中一共展示了CSaleBasket::GetList方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: AddGoogleAnaliticsEcommerceCode

    function AddGoogleAnaliticsEcommerceCode($orderId, $arOrder, $arParams){

        global $APPLICATION;

        if(isset($_SESSION['GA_ORDER_ID']) && $_SESSION['GA_ORDER_ID'] == $orderId) return;

        $gaOutput = array();

        $arSite = CSite::GetByID($arOrder['LID'])->Fetch();

        $gaOutput[] = "<script>";
        $gaOutput[] = "ga('require', 'ecommerce', 'ecommerce.js');";

        $gaOutput[] = sprintf(
            "ga('ecommerce:addTransaction', {
                'id': '%s',
                'affiliation': '%s',
                'revenue': '%s',
                'shipping': '%s',
                'tax': ''
            });",
            $orderId,
            $arSite['NAME'],
            $arOrder['PRICE'],
            $arOrder['PRICE_DELIVERY']
        );

        $dbBasket = CSaleBasket::GetList(
            array("NAME" => "ASC"),
            array("ORDER_ID" => $orderId)
        );

        while($basketItem = $dbBasket->fetch()){

            $gaOutput[] = sprintf(
                "ga('ecommerce:addItem', {
                    'id': '%s',
                    'name': '%s',
                    'sku': '%s',
                    'category': '',
                    'price': '%s',
                    'quantity': '%s'
                });",
                $orderId,
                $basketItem['NAME'],
                $basketItem['PRODUCT_ID'],
                $basketItem['PRICE'],
                $basketItem['QUANTITY']
            );

        }

        $gaOutput[] = "ga('ecommerce:send');";
        $gaOutput[] = "</script>";

        $APPLICATION->AddHeadString(implode("\n", $gaOutput), true);

        $_SESSION['GA_ORDER_ID'] = $orderId;

    }
開發者ID:nycmic,項目名稱:bittest,代碼行數:60,代碼來源:init.php

示例2: isBarCodeValid

 public static function isBarCodeValid($arParams)
 {
     $bResult = false;
     $arBasket = array();
     if (intval($arParams["basketItemId"]) > 0) {
         $dbBasket = CSaleBasket::GetList(array("ID" => "DESC"), array("ID" => $arParams["basketItemId"]), false, false, array("ID", "PRODUCT_ID", "PRODUCT_PROVIDER_CLASS", "MODULE", "BARCODE_MULTI"));
         $arBasket = $dbBasket->GetNext();
     } else {
         $arBasket = array("PRODUCT_PROVIDER_CLASS" => $arParams["productProvider"], "MODULE" => $arParams["moduleName"], "PRODUCT_ID" => $arParams["productId"], "BARCODE_MULTI" => $arParams["barcodeMult"]);
     }
     if (!empty($arBasket) && is_array($arBasket)) {
         /** @var $productProvider IBXSaleProductProvider */
         if ($productProvider = CSaleBasket::GetProductProvider($arBasket)) {
             $arCheckBarcodeFields = array("BARCODE" => $arParams["barcode"], "PRODUCT_ID" => $arBasket["PRODUCT_ID"], "ORDER_ID" => $arParams["orderId"]);
             if ($arBasket["BARCODE_MULTI"] == "Y") {
                 $arCheckBarcodeFields["STORE_ID"] = $arParams["storeId"];
             }
             $res = $productProvider::CheckProductBarcode($arCheckBarcodeFields);
             if ($res) {
                 $bResult = true;
             }
         }
     }
     return $bResult;
 }
開發者ID:Satariall,項目名稱:izurit,代碼行數:25,代碼來源:order_helper.php

示例3: OrderBasket

    /**
     *
    * return array() BasketList - experation - Send Order
    **/
    public static function OrderBasket($experation = NULL,$sort = array("ID" => "ASC"), $limit = NULL){
        global $DB;
        $arItems = array();
        if(! $experation){
            $experation = 30*24*60*60;
        }
        $time = date($DB->DateFormatToPHP(CSite::GetDateFormat("FULL", SITE_ID)), time() - $experation);
        $arPages = false;
        if(! empty($limit)){
            $arPages = array('nTopCount' =>  $limit);
        }
        $arFilter = array('>=DATE_UPDATE' => $time,
                          "ORDER_ID" => true,
                          "CAN_BUY" => "Y");
        $arSelect = array("ID", "USER_ID", "PRODUCT_ID", "CAN_BUY", "DELAY", "SUBSCRIBE", "QUANTITY","DATE_UPDATE","DETAIL_PAGE_URL");
        $dbBasketList = CSaleBasket::GetList(
				$sort,
				$arFilter,
				false,
				$arPages,
				$arSelect
			);
			while($_arItems = $dbBasketList->Fetch()){
				$arItems[] = $_arItems;
			}
        return $arItems;
    }
開發者ID:Kulkow,項目名稱:ipdesign.k1785,代碼行數:31,代碼來源:basket.php

示例4: GetBasketList

function GetBasketList($bSkipFUserInit = true)
{
    $fUserID = (int) CSaleBasket::GetBasketUserID($bSkipFUserInit);
    $arRes = array();
    if ($fUserID > 0) {
        $basketID = array();
        $db_res = CSaleBasket::GetList(array(), array("FUSER_ID" => $fUserID, "LID" => SITE_ID, "ORDER_ID" => false), false, false, array('ID', 'CALLBACK_FUNC', 'PRODUCT_PROVIDER_CLASS', 'MODULE', 'PRODUCT_ID', 'QUANTITY', 'NOTES'));
        while ($res = $db_res->Fetch()) {
            $res['CALLBACK_FUNC'] = (string) $res['CALLBACK_FUNC'];
            $res['PRODUCT_PROVIDER_CLASS'] = (string) $res['PRODUCT_PROVIDER_CLASS'];
            if ($res['CALLBACK_FUNC'] != '' || $res['PRODUCT_PROVIDER_CLASS'] != '') {
                CSaleBasket::UpdatePrice($res["ID"], $res["CALLBACK_FUNC"], $res["MODULE"], $res["PRODUCT_ID"], $res["QUANTITY"], 'N', $res["PRODUCT_PROVIDER_CLASS"], $res['NOTES']);
            }
            $basketID[] = $res['ID'];
        }
        unset($res, $db_res);
        if (!empty($basketID)) {
            $basketIterator = CSaleBasket::GetList(array('NAME' => 'ASC'), array('ID' => $basketID));
            while ($basket = $basketIterator->GetNext()) {
                $arRes[] = $basket;
            }
            unset($basket, $basketIterator);
        }
        unset($basketID);
    }
    return $arRes;
}
開發者ID:DarneoStudio,項目名稱:bitrix,代碼行數:27,代碼來源:include.php

示例5: getUserDelay

function getUserDelay ($userId){
    // Получаем список корзины
    $arBasketItems = array();
    $dbBasketItems = CSaleBasket::GetList(
            array(
                    "NAME" => "ASC",
                    "ID" => "ASC"
                ),
            array(
                    "FUSER_ID" =>$userId,
                    "LID" => SITE_ID,
                    "ORDER_ID" => "NULL"
                ),
            false,
            false,
            array("ID", "CALLBACK_FUNC", "MODULE", "NAME", 
                  "PRODUCT_ID", "QUANTITY", "DELAY", 
                  "CAN_BUY", "PRICE", "DATE_INSERT", "DATE_UPDATE")
        );
    while ($arItems = $dbBasketItems->Fetch())
    {
        if (strlen($arItems["CALLBACK_FUNC"]) > 0)
        {
            CSaleBasket::UpdatePrice($arItems["ID"], 
                                     $arItems["CALLBACK_FUNC"], 
                                     $arItems["MODULE"], 
                                     $arItems["PRODUCT_ID"], 
                                     $arItems["QUANTITY"]);
            $arItems = CSaleBasket::GetByID($arItems["ID"]);
        }

        $arBasketItems[] = $arItems;
    }

    // Печатаем массив, содержащий актуальную на текущий момент корзину
   /* echo "<pre>";
    print_r($arBasketItems);
    echo "</pre>"; */ 
    
    $whishlist="";
    foreach ($arBasketItems as $delay){  
        $notBuy="Y"; // флаг для проверки покупался ли данный товар,
       $difference = floor(intval(abs( time() - strtotime($delay[DATE_INSERT]) ))/(3600 * 24));  
        // перебираем отложенные элементы, срок которых менее 30 дней        
        if ($delay["DELAY"]=="Y" && $difference < 30){
            foreach ($arBasketItems as $notDelay){
                //перебираем купленные элементы и сравниваем с отложенными
                if ($notDelay["DELAY"]!="Y" && $delay[PRODUCT_ID]==$notDelay[PRODUCT_ID] && $difference < 30){
                   $notBuy="N";  // товар уже покупался                  
                }                
            }
            if($notBuy=="Y"){
            $whishlist .= ' '.$delay["NAME"].',';    
            }
        }        
    }
    $whishlist = trim($whishlist, ",");
    return  $whishlist;    
}
開發者ID:russeljo,項目名稱:ratio_test,代碼行數:59,代碼來源:task2a.php

示例6: getOrderItems

 /**
  * get item data for order or current cart
  *
  * @param int $order_id send null for current cart
  * @param bool $item_more_data
  * @return array
  */
 public static function getOrderItems($order_id = null, $item_more_data = false)
 {
     $items = array();
     $libBasket = new \CSaleBasket();
     if ($order_id !== null) {
         $list = $libBasket->GetList(array(), array('ORDER_ID' => $order_id));
     } else {
         $list = $libBasket->GetList(array(), array('FUSER_ID' => $libBasket->GetBasketUserID(), 'LID' => SITE_ID, 'ORDER_ID' => false));
     }
     while ($item = $list->Fetch()) {
         $itemData = self::getItemArray($item['PRODUCT_ID'], $item_more_data);
         $item['PRODUCT_ID'] = $itemData['item_id'];
         // fix ID for complex items
         $item['DATA'] = $itemData;
         $items[] = $item;
     }
     return $items;
 }
開發者ID:ASDAFF,項目名稱:rees46_bitrix,代碼行數:25,代碼來源:Data.php

示例7: OnBeforeBasketAdd

 public static function OnBeforeBasketAdd(array $fields)
 {
     if (Loader::includeModule('conversion')) {
         if ($row = \CSaleBasket::GetList(array(), array('LID' => $fields['LID'], 'FUSER_ID' => $fields['FUSER_ID'], 'PRODUCT_ID' => $fields['PRODUCT_ID'], 'ORDER_ID' => 'NULL'), false, false, array('PRICE', 'QUANTITY'))->Fetch()) {
             self::$cartSum = $row['PRICE'] * $row['QUANTITY'];
         } else {
             self::$cartSum = 0;
         }
     }
 }
開發者ID:DarneoStudio,項目名稱:bitrix,代碼行數:10,代碼來源:handlers.php

示例8: GetBasketProductsQuantity

 /**
  * Get quantity of basket product's articuls
  *
  * @return integer
  */
 public static function GetBasketProductsQuantity()
 {
     CModule::IncludeModule('sale');
     $i = 0;
     $rsBasketProducts = CSaleBasket::GetList(array(), array("FUSER_ID" => CSaleBasket::GetBasketUserID(), "LID" => SS_SHOP_ID, "ORDER_ID" => "NULL"), false, false, array("ID"));
     while ($arItem = $rsBasketProducts->GetNext()) {
         $i++;
     }
     return $i;
 }
開發者ID:ASDAFF,項目名稱:bitrix-snippets,代碼行數:15,代碼來源:class.SaleHelper.php

示例9: GetBasketList

function GetBasketList($bSkipFUserInit = False)
{
    $fUserID = CSaleBasket::GetBasketUserID($bSkipFUserInit);
    $arRes = array();
    if ($fUserID > 0) {
        $db_res = CSaleBasket::GetList(array("NAME" => "ASC"), array("FUSER_ID" => $fUserID, "LID" => SITE_ID, "ORDER_ID" => "NULL"));
        while ($res = $db_res->GetNext()) {
            if (strlen($res["CALLBACK_FUNC"]) > 0 || strlen($res["PRODUCT_PROVIDER_CLASS"]) > 0) {
                CSaleBasket::UpdatePrice($res["ID"], $res["CALLBACK_FUNC"], $res["MODULE"], $res["PRODUCT_ID"], $res["QUANTITY"], $res["PRODUCT_PROVIDER_CLASS"]);
                $res = CSaleBasket::GetByID($res["ID"]);
            }
            $arRes[] = $res;
        }
    }
    return $arRes;
}
開發者ID:k-kalashnikov,項目名稱:geekcon_new,代碼行數:16,代碼來源:include.php

示例10: onGenerateInitialData

 public static function onGenerateInitialData(Date $from, Date $to)
 {
     $data = array();
     // 1. Payments
     $result = \CSaleOrder::GetList(array(), array('PAYED' => 'Y', 'CANCELED' => 'N', '>=DATE_PAYED' => $from, '<=DATE_PAYED' => $to), false, false, array('LID', 'DATE_PAYED', 'PRICE', 'CURRENCY'));
     while ($row = $result->Fetch()) {
         $day = new DateTime($row['DATE_PAYED']);
         $sum = Utils::convertToBaseCurrency($row['PRICE'], $row['CURRENCY']);
         if ($counters =& $data[$row['LID']][$day->format('Y-m-d')]) {
             $counters['sale_payment_add_day'] += 1;
             $counters['sale_payment_sum_add'] += $sum;
         } else {
             $counters = array('sale_payment_add_day' => 1, 'sale_payment_sum_add' => $sum);
         }
     }
     // 2. Orders
     $result = \CSaleOrder::GetList(array(), array('CANCELED' => 'N', '>=DATE_INSERT' => $from, '<=DATE_INSERT' => $to), false, false, array('LID', 'DATE_INSERT', 'PRICE', 'CURRENCY'));
     while ($row = $result->Fetch()) {
         $day = new DateTime($row['DATE_INSERT']);
         $sum = Utils::convertToBaseCurrency($row['PRICE'], $row['CURRENCY']);
         if ($counters =& $data[$row['LID']][$day->format('Y-m-d')]) {
             $counters['sale_order_add_day'] += 1;
             $counters['sale_order_sum_add'] += $sum;
         } else {
             $counters = array('sale_order_add_day' => 1, 'sale_order_sum_add' => $sum);
         }
     }
     // 3. Cart
     $result = \CSaleBasket::GetList(array(), array('>=DATE_INSERT' => $from, '<=DATE_INSERT' => $to), false, false, array('LID', 'DATE_INSERT', 'PRICE', 'CURRENCY', 'QUANTITY'));
     while ($row = $result->Fetch()) {
         $day = new DateTime($row['DATE_INSERT']);
         $sum = Utils::convertToBaseCurrency($row['PRICE'] * $row['QUANTITY'], $row['CURRENCY']);
         if ($counters =& $data[$row['LID']][$day->format('Y-m-d')]) {
             $counters['sale_cart_add_day'] += 1;
             $counters['sale_cart_sum_add'] += $sum;
         } else {
             $counters = array('sale_cart_add_day' => 1, 'sale_cart_sum_add' => $sum);
         }
     }
     // Result
     unset($counters);
     $result = array();
     foreach ($data as $siteId => $dayCounters) {
         $result[] = array('ATTRIBUTES' => array('conversion_site' => $siteId), 'DAY_COUNTERS' => $dayCounters);
     }
     return $result;
 }
開發者ID:akniyev,項目名稱:itprom_dobrohost,代碼行數:47,代碼來源:conversionhandlers.php

示例11: OnBasketChange

	public static function OnBasketChange($ID, $arFields = false)
	{
		if(isset($_SESSION["SALE_BASKET_NUM_PRODUCTS"][SITE_ID]))
		{
			$num_products = $_SESSION["SALE_BASKET_NUM_PRODUCTS"][SITE_ID];
		}
		else
		{
			if(!CModule::IncludeModule("sale"))
			{
				return;
			}
			$fUserID = CSaleBasket::GetBasketUserID(True);
			$fUserID = IntVal($fUserID);
			$num_products = 0;
			if ($fUserID > 0)
			{
				$dbRes = CSaleBasket::GetList(
					array(),
					array(
						"FUSER_ID" => $fUserID,
						"LID" => SITE_ID,
						"ORDER_ID" => "NULL",
						"CAN_BUY" => "Y",
						"DELAY" => "N",
						"SUBSCRIBE" => "N"
					)
				);
				while ($arItem = $dbRes->GetNext())
				{
					if (!CSaleBasketHelper::isSetItem($arItem))
						$num_products++;
				}
			}
			$_SESSION["SALE_BASKET_NUM_PRODUCTS"][SITE_ID] = intval($num_products);
		}

		echo "<script>
			if (document.getElementById('bx_cart_num'))
				document.getElementById('bx_cart_num').innerHTML = '".(($num_products > 0) ? " (".$num_products.")" : "")."';
			</script>";
	}
開發者ID:ASDAFF,項目名稱:entask.ru,代碼行數:42,代碼來源:include.php

示例12: OnSalePayOrder

 public static function OnSalePayOrder($ID, $val)
 {
     $ID = intval($ID);
     if ($ID > 0 && $val == 'Y') {
         $arOrder = array();
         $dbBasketItems = CSaleBasket::GetList(array(), array('ORDER_ID' => $ID), false, false, array('ID', 'MODULE', 'CATALOG_XML_ID', 'QUANTITY'));
         while ($arItems = $dbBasketItems->Fetch()) {
             if ($arItems['MODULE'] == 'asd.money' && !empty($arItems['CATALOG_XML_ID']) && strpos($arItems['CATALOG_XML_ID'], '@') !== false) {
                 if (empty($arOrder)) {
                     $rsOrders = CSaleOrder::GetList(array(), array('ID' => $ID), false, false, array('ID', 'USER_ID'));
                     $arOrder = $rsOrders->Fetch();
                     if (empty($arOrder)) {
                         return;
                     }
                 }
                 list($amount, $curr) = explode('@', $arItems['CATALOG_XML_ID']);
                 CSaleUserAccount::UpdateAccount($arOrder['USER_ID'], doubleval($amount) * doubleval($arItems['QUANTITY']), $curr, GetMessage('ASD_MODULE_TRANSACT_PREPAID'), $ID);
             }
         }
     }
 }
開發者ID:Hawkart,項目名稱:megatv,代碼行數:21,代碼來源:include.php

示例13: elseif

         } 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

示例14: fGetUserShoppingCart

function fGetUserShoppingCart($arProduct, $LID, $recalcOrder)
{
	$arOrderProductPrice = array();
	$i = 0;

	$arSortNum = array();
	foreach($arProduct as $key => $val)
	{
		$arSortNum[] = $val['PRICE_DEFAULT'];
		$arProduct[$key]["PRODUCT_ID"] = (int)$val["PRODUCT_ID"];
		$arProduct[$key]["TABLE_ROW_ID"] = $key;
	}
	if (!empty($arProduct) && !empty($arSortNum))
		array_multisort($arSortNum, SORT_DESC, $arProduct);

	$arBasketIds = array();
	$basketMap = array();
	foreach($arProduct as $key => $val)
	{
		$val["QUANTITY"] = abs(str_replace(",", ".", $val["QUANTITY"]));
		$val["QUANTITY_DEFAULT"] = $val["QUANTITY"];
		$val["PRICE"] = str_replace(",", ".", $val["PRICE"]);

		// Y is used when custom price was set in the admin form
		if ($val["CALLBACK_FUNC"] == "Y")
		{
			$val["CALLBACK_FUNC"] = false;
			$val["CUSTOM_PRICE"] = "Y";

			if (isset($val["BASKET_ID"]) && (int)$val["BASKET_ID"] > 0)
			{
				CSaleBasket::Update($val["BASKET_ID"], array("CUSTOM_PRICE" => "Y"));
			}

			//$val["DISCOUNT_PRICE"] = $val["PRICE_DEFAULT"] - $val["PRICE"];
		}

		$arOrderProductPrice[$i] = $val;
		$arOrderProductPrice[$i]["TABLE_ROW_ID"] = $val["TABLE_ROW_ID"];
		$arOrderProductPrice[$i]["NAME"] = htmlspecialcharsback($val["NAME"]);
		$arOrderProductPrice[$i]["LID"] = $LID;
		$arOrderProductPrice[$i]["CAN_BUY"] = "Y";
		$arOrderProductPrice[$i]['RESERVED'] = 'N';

		if (isset($val["BASKET_ID"]) && (int)$val["BASKET_ID"] > 0)
		{
			$basketId = (int)$val["BASKET_ID"];
			$arOrderProductPrice[$i]["ID"] = $basketId;

			$arBasketIds[] = $basketId;
			$basketMap[$basketId] = &$arOrderProductPrice[$i];

			if ($recalcOrder != "Y" && $arOrderProductPrice[$i]["CALLBACK_FUNC"] != false)
				unset($arOrderProductPrice[$i]["CALLBACK_FUNC"]);

			$arNewProps = array();
			if (is_array($val["PROPS"]))
			{
				foreach($val["PROPS"] as $k => $v)
				{
					if ($v["NAME"] != "" AND $v["VALUE"] != "")
						$arNewProps[$k] = $v;
				}
			}
			else
				$arNewProps = array("NAME" => "", "VALUE" => "", "CODE" => "", "SORT" => "");

			$arOrderProductPrice[$i]["PROPS"] = $arNewProps;
		}
		$i++;
	}//endforeach $arProduct

	// collect status of reservation elements basket
	if (!empty($arBasketIds))
	{
		$rsBasketItems = CSaleBasket::GetList(
			array(),
			array("ID" => $arBasketIds),
			false,
			false,
			array(
				"ID",
				"RESERVED",
			)
		);
		while ($arBasketItems = $rsBasketItems->Fetch())
		{
			$arBasketItems['ID'] = (int)$arBasketItems['ID'];
			if (!isset($basketMap[$arBasketItems['ID']]))
				continue;
			$basketMap[$arBasketItems['ID']]['RESERVED'] = $arBasketItems['RESERVED'];
		}
		unset($arBasketItems, $rsBasketItems);
	}
	unset($basketMap, $arBasketIds);

	return $arOrderProductPrice;
}
開發者ID:akniyev,項目名稱:arteva.ru,代碼行數:98,代碼來源:admin_tool.php

示例15: recalculateBasket

 public function recalculateBasket($arPost)
 {
     global $USER;
     $arRes = array();
     if ($this->hideCoupon != "Y") {
         if (!empty($arPost['delete_coupon'])) {
             $arRes['VALID_COUPON'] = DiscountCouponsManager::delete($arPost['delete_coupon']);
         } else {
             $oldUse = false;
             if (array_key_exists('coupon', $arPost)) {
                 $arPost['coupon'] = trim((string) $arPost['coupon']);
                 if ($arPost['coupon'] != '') {
                     $arRes['VALID_COUPON'] = DiscountCouponsManager::add($arPost['coupon']);
                 } else {
                     $oldUse = true;
                 }
             }
             if ($oldUse) {
                 if (!isset($arRes["VALID_COUPON"]) || $arRes["VALID_COUPON"] === false) {
                     DiscountCouponsManager::clear(true);
                 }
             }
         }
     }
     $arTmpItems = array();
     $dbItems = CSaleBasket::GetList(array("PRICE" => "DESC"), array("FUSER_ID" => CSaleBasket::GetBasketUserID(), "LID" => SITE_ID, "ORDER_ID" => "NULL"), false, false, array("ID", "NAME", "PRODUCT_PROVIDER_CLASS", "CALLBACK_FUNC", "MODULE", "PRODUCT_ID", "QUANTITY", "DELAY", "CAN_BUY", "CURRENCY", "SUBSCRIBE", "TYPE", "SET_PARENT_ID", "NOTES"));
     while ($arItem = $dbItems->Fetch()) {
         if (CSaleBasketHelper::isSetItem($arItem)) {
             continue;
         }
         $arTmpItems[] = $arItem;
     }
     if (!empty($arTmpItems)) {
         if (self::$catalogIncluded === null) {
             self::$catalogIncluded = Loader::includeModule('catalog');
         }
         if (self::$catalogIncluded) {
             $arTmpItems = getRatio($arTmpItems);
         }
         foreach ($arTmpItems as $arItem) {
             $isFloatQuantity = isset($arItem["MEASURE_RATIO"]) && floatval($arItem["MEASURE_RATIO"]) > 0 && $arItem["MEASURE_RATIO"] != 1 || $this->quantityFloat == "Y" ? true : false;
             if (!isset($arPost["QUANTITY_" . $arItem["ID"]]) || floatval($arPost["QUANTITY_" . $arItem["ID"]]) <= 0) {
                 $quantityTmp = $isFloatQuantity === true ? floatval($arItem["QUANTITY"]) : intval($arItem["QUANTITY"]);
             } else {
                 $quantityTmp = $isFloatQuantity === true ? floatval($arPost["QUANTITY_" . $arItem["ID"]]) : intval($arPost["QUANTITY_" . $arItem["ID"]]);
             }
             $deleteTmp = $arPost["DELETE_" . $arItem["ID"]] == "Y" ? "Y" : "N";
             $delayTmp = $arPost["DELAY_" . $arItem["ID"]] == "Y" ? "Y" : "N";
             if ($arItem["CAN_BUY"] == "Y") {
                 $res = $this->checkQuantity($arItem, $quantityTmp);
                 if (!empty($res)) {
                     $arRes["WARNING_MESSAGE"][] = $res["ERROR"];
                 }
             }
             if ($deleteTmp == "Y" && in_array("DELETE", $this->columns)) {
                 if ($arItem["SUBSCRIBE"] == "Y" && is_array($_SESSION["NOTIFY_PRODUCT"][$USER->GetID()])) {
                     unset($_SESSION["NOTIFY_PRODUCT"][$USER->GetID()][$arItem["PRODUCT_ID"]]);
                 }
                 CSaleBasket::Delete($arItem["ID"]);
             } elseif ($arItem["DELAY"] == "N" && $arItem["CAN_BUY"] == "Y") {
                 $arFields = array();
                 if (in_array("QUANTITY", $this->columns)) {
                     $arFields["QUANTITY"] = $quantityTmp;
                 }
                 if (in_array("DELAY", $this->columns)) {
                     $arFields["DELAY"] = $delayTmp;
                 }
                 if (!empty($arFields) && ($arItem["QUANTITY"] != $arFields["QUANTITY"] && in_array("QUANTITY", $this->columns) || $arItem["DELAY"] != $arFields["DELAY"] && in_array("DELAY", $this->columns))) {
                     CSaleBasket::Update($arItem["ID"], $arFields);
                 }
             } elseif ($arItem["DELAY"] == "Y" && $arItem["CAN_BUY"] == "Y") {
                 $arFields = array();
                 if (in_array("DELAY", $this->columns)) {
                     $arFields["DELAY"] = $delayTmp;
                 }
                 if (!empty($arFields) && ($arItem["DELAY"] != $arFields["DELAY"] && in_array("DELAY", $this->columns))) {
                     CSaleBasket::Update($arItem["ID"], $arFields);
                 }
             }
         }
     }
     return $arRes;
 }
開發者ID:DarneoStudio,項目名稱:bitrix,代碼行數:83,代碼來源:class.php


注:本文中的CSaleBasket::GetList方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。