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


PHP CSaleBasket::GetBasketUserID方法代码示例

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


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

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

示例2: getProductInBasketParams

 /**
  * Returns quantity of product in current user's basket
  *
  * @param integer $productID
  * @return float
  */
 public static function getProductInBasketParams($productID)
 {
     global $DB;
     CModule::IncludeModule('sale');
     $id = intval($productID);
     $fuserID = CSaleBasket::GetBasketUserID();
     $strSql = "SELECT ID, QUANTITY " . "FROM b_sale_basket " . "WHERE PRODUCT_ID = " . $id . " AND FUSER_ID = " . $fuserID . " AND ORDER_ID IS NULL";
     $rsBasket = $DB->Query($strSql, false, "File: " . __FILE__ . "<br>Line: " . __LINE__);
     if ($arBasket = $rsBasket->Fetch()) {
         return array("ID" => $arBasket["ID"], "QUANTITY" => floatval($arBasket["QUANTITY"]));
     }
     return false;
 }
开发者ID:ASDAFF,项目名称:bitrix-snippets,代码行数:19,代码来源:class.SaleHelper.php

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

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

示例5: getNmuBasket

 function getNmuBasket(){
     $dbBasketItems = CSaleBasket::GetList(
     array(
             "NAME" => "ASC",
             "ID" => "ASC"
             ),
     array(
             "FUSER_ID" => CSaleBasket::GetBasketUserID(),
             "LID" => SITE_ID,
             "ORDER_ID" => "NULL"
             ),
     false,
     false,
     array()
     );
     $num=0;
     while($basket=$dbBasketItems->Fetch()) $num++;
     return $num;
 }
开发者ID:ASDAFF,项目名称:bitrix-solution.video,代码行数:19,代码来源:calculate.php

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

示例7: doubleval

$quantity = doubleval($_REQUEST["quantity"]);
$delay = strtoupper($_REQUEST["delay"]) == "Y" ? true : false;
if ($quantity <= 0) {
    $quantity = 1;
}
if (CModule::IncludeModule("catalog")) {
    if (($action == "ADD2BASKET" || $action == "BUY") && $id > 0) {
        $r_id = Add2BasketByProductID($id, $quantity, array());
        if ($delay) {
            CSaleBasket::Update($r_id, array("DELAY" => "Y"));
        }
        // if ajax return some info about cart
        if (!empty($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest') {
            /* special ajax here */
            //header('Content-Type: application/json');
            $cntBasketItems = CSaleBasket::GetList(array(), array("FUSER_ID" => CSaleBasket::GetBasketUserID(), "LID" => SITE_ID, "ORDER_ID" => "NULL"), array());
            echo "{'id': {$r_id} , 'count': {$cntBasketItems}}";
            exit(0);
        }
        if ($action == "BUY") {
            LocalRedirect("/personal/cart");
        }
        if ($backurl) {
            LocalRedirect($backurl);
        } elseif ($_SERVER["HTTP_REFERER"]) {
            LocalRedirect($_SERVER["HTTP_REFERER"]);
        } else {
            LocalRedirect("/personal/cart");
        }
    }
}
开发者ID:rasuldev,项目名称:torino,代码行数:31,代码来源:cart.php

示例8: foreach

        foreach ($arRes as $key => $value) {
            $arResult[$key] = $value;
        }
        unset($_SESSION["SALE_BASKET_NUM_PRODUCTS"][SITE_ID]);
        if (!empty($_REQUEST["BasketOrder"]) && empty($arResult["WARNING_MESSAGE"])) {
            if (!(strlen($_POST['paypalbutton']) > 0)) {
                LocalRedirect($arParams["PATH_TO_ORDER"]);
            }
        } else {
            unset($_REQUEST["BasketRefresh"], $_REQUEST["BasketOrder"]);
            if (!empty($arResult["WARNING_MESSAGE"])) {
                $_SESSION["SALE_BASKET_MESSAGE"] = $arResult["WARNING_MESSAGE"];
            }
            LocalRedirect($APPLICATION->GetCurPage());
        }
    }
} elseif (!empty($_REQUEST['DeleteAll']) && $_REQUEST['DeleteAll'] == 'Y') {
    CSaleBasket::DeleteAll(CSaleBasket::GetBasketUserID());
    LocalRedirect($APPLICATION->GetCurPage());
}
$basketData = $this->getBasketItems();
$arResult = array_merge($arResult, $basketData);
$arResult["GRID"]["HEADERS"] = $headersData;
if (is_array($_SESSION["SALE_BASKET_MESSAGE"])) {
    foreach ($_SESSION["SALE_BASKET_MESSAGE"] as $message) {
        $arResult["WARNING_MESSAGE"][] = $message;
    }
    unset($_SESSION["SALE_BASKET_MESSAGE"]);
}
CJSCore::Init(array('ajax'));
$this->IncludeComponentTemplate();
开发者ID:AlexPrya,项目名称:redvent.ru,代码行数:31,代码来源:component.php

示例9: AuthtorizeAfterAds


//.........这里部分代码省略.........
                 $res = CPrice::GetList(
                     array(),
                     array(
                         "PRODUCT_ID" => $PRODUCT_ID,
                         "CATALOG_GROUP_ID" => $PRICE_TYPE_ID
                     )
                 );

                 if ($arr = $res->Fetch())
                 {
                     CPrice::Update($arr["ID"], $arFieldsprice,true);
                     $_SESSION['price_add']=$arr;
                 }
                 else
                 {
                     CPrice::Add($arFieldsprice,true);
                 }
             }

         }


        // добавление в корзину vip и поднять
        if(($arFields["IBLOCK_ID"] == 16)&&(($arFields["PROPERTY_VALUES"][81][0]==40)||($arFields["PROPERTY_VALUES"][81][0]==46))){
            
            unset($_SESSION['ELEMENT_ADS_ID']);
            if(($_REQUEST['CODE'])&&(CModule::IncludeModule("iblock"))){

                if((CModule::IncludeModule("catalog"))&&(CModule::IncludeModule("sale"))){

                    $dbBasketItems = CSaleBasket::GetList(
                        array(),
                        array(
                            "FUSER_ID" => CSaleBasket::GetBasketUserID(),
                            "LID" => SITE_ID,
				            "ORDER_ID" => "NULL"
                        ),
                        false,
                        false,
                        array("ID", "NAME")
                    );
                    if($arFields["PROPERTY_VALUES"][81][0]==46){
                        $test_ads="TEST_ADSUP";
                    }
                    if($arFields["PROPERTY_VALUES"][81][0]==40){
                        $test_ads="TEST_VIP";
                    }
                    while ($arBasketItems = $dbBasketItems->Fetch())
                    {
                        $dbProp = CSaleBasket::GetPropsList(array("SORT" => "ASC", "ID" => "ASC"), array("BASKET_ID" => $arBasketItems["ID"]));
                        if($arProp = $dbProp -> GetNext())
                        {
                            $props[] = $arProp;
                            $dbProp = CSaleBasket::GetPropsList(array("SORT" => "ASC", "ID" => "ASC"), array("BASKET_ID" => $arBasketItems["ID"]));
                            if($arProp = $dbProp -> GetNext())
                            {
                                

                                if($arProp['CODE']==$test_ads){
                                    $ELEMENT_ID = intval($arProp['VALUE']);
                                    if($ELEMENT_ID==$_REQUEST['CODE']){
                                        $vip=true;
                                    }
                                }

                            }
开发者ID:ASDAFF,项目名称:gpbitrix,代码行数:67,代码来源:class.php

示例10: array

         if ($withdrawSum > 0) {
             $arFields = array("SUM_PAID" => $withdrawSum, "USER_ID" => $USER->GetID());
             CSaleOrder::Update($arResult["ORDER_ID"], $arFields);
             if ($withdrawSum == $orderTotalSum) {
                 CSaleOrder::PayOrder($arResult["ORDER_ID"], "Y", False, False);
             }
         }
     }
     if ($arResult["HAVE_PREPAYMENT"]) {
         if ($psPreAction && $psPreAction->IsAction()) {
             $psPreAction->orderId = $arResult["ORDER_ID"];
             $psPreAction->orderAmount = $orderTotalSum;
             $psPreAction->deliveryAmount = $arResult["DELIVERY_PRICE"];
             $psPreAction->taxAmount = $arResult["TAX_PRICE"];
             $orderData = array();
             $dbBasketItems = CSaleBasket::GetList(array("ID" => "ASC"), array("FUSER_ID" => CSaleBasket::GetBasketUserID(), "LID" => SITE_ID, "ORDER_ID" => $arResult["ORDER_ID"]), false, false, array("ID", "QUANTITY", "PRICE", "WEIGHT", "NAME", "CURRENCY", "PRODUCT_ID", "DETAIL_PAGE_URL"));
             while ($arItem = $dbBasketItems->Fetch()) {
                 $orderData['BASKET_ITEMS'][] = $arItem;
             }
             $psPreAction->payOrder($orderData);
         }
     }
 }
 if (empty($arResult["ERROR"])) {
     CSaleOrderUserProps::DoSaveUserProfile($USER->GetID(), $arUserResult["PROFILE_ID"], $arUserResult["PROFILE_NAME"], $arUserResult["PERSON_TYPE_ID"], $arUserResult["ORDER_PROP"], $arResult["ERROR"]);
 }
 // mail message
 if (empty($arResult["ERROR"])) {
     $i = 0;
     $strOrderList = "";
     $arBasketList = array();
开发者ID:sharapudinov,项目名称:lovestore.top,代码行数:31,代码来源:component.php

示例11: ClearUserBasket

/**
 * 
 */
function ClearUserBasket()
{
	if(!CModule::IncludeModule("sale"))
		return;
		
	if(!defined("BASKET_CLEAR"))
		define("BASKET_CLEAR", true);
				
	$PATH = BASKET_CACHE_PATH . CSaleBasket::GetBasketUserID();
	
	BxClearCache(true, $PATH);
}
开发者ID:ASDAFF,项目名称:alba,代码行数:15,代码来源:init.php

示例12: trim

$arParams["PATH_TO_BASKET"] = trim($arParams["PATH_TO_BASKET"]);
$arParams["PATH_TO_ORDER"] = trim($arParams["PATH_TO_ORDER"]);
$arParams['SHOW_DELAY'] = isset($arParams['SHOW_DELAY']) && $arParams['SHOW_DELAY'] == 'N' ? 'N' : 'Y';
$arParams['SHOW_NOTAVAIL'] = isset($arParams['SHOW_NOTAVAIL']) && $arParams['SHOW_NOTAVAIL'] == 'N' ? 'N' : 'Y';
$arParams['SHOW_SUBSCRIBE'] = isset($arParams['SHOW_SUBSCRIBE']) && $arParams['SHOW_SUBSCRIBE'] == 'N' ? 'N' : 'Y';
$bReady = false;
$bDelay = false;
$bNotAvail = false;
$bSubscribe = false;
$arItems = array();
$arReadyItems = array();
$allSum = 0.0;
$allWeight = 0.0;
$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"];
        }
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:31,代码来源:component.php

示例13: array

</h1>
	
<div class="breadcrumb">
	<?php 
$APPLICATION->IncludeComponent("bitrix:breadcrumb", "content", array("START_FROM" => "0", "PATH" => "", "SITE_ID" => ""), false);
?>
</div>

<div class="shadow-item_info"><img border="0" alt="" src="<?php 
echo SITE_TEMPLATE_PATH;
?>
/images/shadow-item_info.png"></div>

<?php 
$APPLICATION->IncludeComponent("bitrix:catalog.search", "shop", array("IBLOCK_TYPE" => $arParams["IBLOCK_TYPE"], "IBLOCK_ID" => $arParams["IBLOCK_ID"], "ELEMENT_SORT_FIELD" => $arParams["ELEMENT_SORT_FIELD"], "ELEMENT_SORT_ORDER" => $arParams["ELEMENT_SORT_ORDER"], "PAGE_ELEMENT_COUNT" => $arParams["PAGE_ELEMENT_COUNT"], "LINE_ELEMENT_COUNT" => $arParams["LINE_ELEMENT_COUNT"], "PROPERTY_CODE" => $arParams["LIST_PROPERTY_CODE"], "OFFERS_CART_PROPERTIES" => $arParams["OFFERS_CART_PROPERTIES"], "OFFERS_FIELD_CODE" => $arParams["LIST_OFFERS_FIELD_CODE"], "OFFERS_PROPERTY_CODE" => $arParams["LIST_OFFERS_PROPERTY_CODE"], "OFFERS_SORT_FIELD" => $arParams["OFFERS_SORT_FIELD"], "OFFERS_SORT_ORDER" => $arParams["OFFERS_SORT_ORDER"], "OFFERS_LIMIT" => $arParams["OFFERS_LIMIT"], "SECTION_URL" => $arParams["SECTION_URL"], "DETAIL_URL" => $arParams["DETAIL_URL"], "BASKET_URL" => $arParams["BASKET_URL"], "ACTION_VARIABLE" => $arParams["ACTION_VARIABLE"], "PRODUCT_ID_VARIABLE" => $arParams["PRODUCT_ID_VARIABLE"], "PRODUCT_QUANTITY_VARIABLE" => $arParams["PRODUCT_QUANTITY_VARIABLE"], "PRODUCT_PROPS_VARIABLE" => $arParams["PRODUCT_PROPS_VARIABLE"], "SECTION_ID_VARIABLE" => $arParams["SECTION_ID_VARIABLE"], "CACHE_TYPE" => $arParams["CACHE_TYPE"], "CACHE_TIME" => $arParams["CACHE_TIME"], "USE_COMPARE" => $arParams["USE_COMPARE"], "PRICE_CODE" => $arParams["PRICE_CODE"], "USE_PRICE_COUNT" => $arParams["USE_PRICE_COUNT"], "SHOW_PRICE_COUNT" => $arParams["SHOW_PRICE_COUNT"], "PRICE_VAT_INCLUDE" => $arParams["PRICE_VAT_INCLUDE"], "PRODUCT_PROPERTIES" => $arParams["PRODUCT_PROPERTIES"], "USE_PRODUCT_QUANTITY" => $arParams["USE_PRODUCT_QUANTITY"], "CONVERT_CURRENCY" => $arParams["CONVERT_CURRENCY"], "CURRENCY_ID" => $arParams["CURRENCY_ID"], "DISPLAY_TOP_PAGER" => $arParams["DISPLAY_TOP_PAGER"], "DISPLAY_BOTTOM_PAGER" => $arParams["DISPLAY_BOTTOM_PAGER"], "PAGER_TITLE" => $arParams["PAGER_TITLE"], "PAGER_SHOW_ALWAYS" => $arParams["PAGER_SHOW_ALWAYS"], "PAGER_TEMPLATE" => $arParams["PAGER_TEMPLATE"], "PAGER_DESC_NUMBERING" => $arParams["PAGER_DESC_NUMBERING"], "PAGER_DESC_NUMBERING_CACHE_TIME" => $arParams["PAGER_DESC_NUMBERING_CACHE_TIME"], "PAGER_SHOW_ALL" => $arParams["PAGER_SHOW_ALL"], "FILTER_NAME" => "searchFilter", "SECTION_ID" => "", "SECTION_CODE" => "", "SECTION_USER_FIELDS" => array(), "INCLUDE_SUBSECTIONS" => "Y", "SHOW_ALL_WO_SECTION" => "Y", "META_KEYWORDS" => "", "META_DESCRIPTION" => "", "BROWSER_TITLE" => "", "ADD_SECTIONS_CHAIN" => "N", "SET_TITLE" => "N", "SET_STATUS_404" => "N", "CACHE_FILTER" => "N", "CACHE_GROUPS" => "N", "RESTART" => "N", "NO_WORD_LOGIC" => "Y", "USE_LANGUAGE_GUESS" => "Y", "CHECK_DATES" => "Y", "CONVERT_CURRENCY" => $arParams["CONVERT_CURRENCY"], "CURRENCY_ID" => $arParams["CURRENCY_ID"], "SHOW_MEASURE" => $arParams["SHOW_MEASURE"]), $component);
$rsBasket = CSaleBasket::GetList(array("NAME" => "ASC", "ID" => "ASC"), array("FUSER_ID" => CSaleBasket::GetBasketUserID(), 'LID' => SITE_ID, 'ORDER_ID' => 'NULL'), false, false, array("ID", "PRODUCT_ID", "DELAY"));
while ($arBasket = $rsBasket->GetNext()) {
    if ($arBasket["DELAY"] == "Y") {
        $delay_items[] = $arBasket["PRODUCT_ID"];
    } else {
        $basket_items[] = $arBasket["PRODUCT_ID"];
    }
}
global $compare_items;
?>

<script>
	$(document).ready(function()
	{
		<?php 
foreach ($delay_items as $item_id) {
开发者ID:Andreyjktl,项目名称:rezina74,代码行数:31,代码来源:search.php

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

示例15: __MakeOrder

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

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

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

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

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

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

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

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


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