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


PHP CSaleBasket::DoGetUserShoppingCart方法代码示例

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


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

示例1: str_replace

                 $userNew = str_replace("#FIO#", "(" . $arUser["LOGIN"] . ") " . $payerName, GetMessage("NEWO_BUYER_REG_OK"));
                 CUser::SendUserInfo($user_id, SITE_ID, $userNew, true);
             }
         } else {
             foreach ($arErrors as $val) {
                 $errorMessage .= $val["TEXT"] . "<br>";
             }
         }
     }
 }
 /*
  * calc basket
  */
 $arErrors = array();
 $arWarnings = array();
 $arShoppingCart = CSaleBasket::DoGetUserShoppingCart(SITE_ID, $currentUserId, intval(CSaleBasket::GetBasketUserID()), $arErrors);
 $productLimit = "";
 if (strlen($_REQUEST["BasketRefresh"]) > 0 || strlen($_REQUEST["BasketOrder"]) > 0 || strlen($_REQUEST["AJAX_CALL"]) > 0) {
     if (in_array("QUANTITY", $arParams["COLUMNS_LIST"])) {
         $arSelect = array("ID", "QUANTITY", "QUANTITY_TRACE", "CAN_BUY_ZERO");
         $arProductIDs = array();
         $arNewQuantity = array();
         foreach ($arShoppingCart as $key => $val) {
             if (array_key_exists("QUANTITY_" . $val["ID"], $_POST)) {
                 $_POST["QUANTITY_" . $val["ID"]] = str_replace(",", ".", $_POST["QUANTITY_" . $val["ID"]]);
                 $dblQuantity = $arParams['QUANTITY_FLOAT'] == 'Y' ? DoubleVal($_POST["QUANTITY_" . $val["ID"]]) : intval($_POST["QUANTITY_" . $val["ID"]]);
                 if ($dblQuantity != $val['QUANTITY']) {
                     if ('catalog' == $val['MODULE']) {
                         $arProductIDs[$val["PRODUCT_ID"]] = $key;
                         $arNewQuantity[$val["PRODUCT_ID"]] = $dblQuantity;
                     } else {
开发者ID:webgksupport,项目名称:alpina,代码行数:31,代码来源:component.php

示例2: fDeleteDoubleProduct

</td></tr></table>
					<br>
					<div id="tabs">
						<?
						$displayNone = "block";
						$displayNoneBasket = "block";
						$displayNoneViewed = "block";

						$arRecommended = CSaleProduct::GetRecommendetProduct($str_USER_ID, $LID, $arFilterRecommended);

						$arRecommendedResult = fDeleteDoubleProduct($arRecommended, $arFilterRecommended, 'N');
						if (empty($arRecommendedResult["ITEMS"]))
							$displayNone = "none";

						$arCartWithoutSetItems = array();
						$arTmpShoppingCart = CSaleBasket::DoGetUserShoppingCart($LID, $str_USER_ID, $FUSER_ID, $arErrors, $arCoupon);

						if (is_array($arTmpShoppingCart))
						{
							foreach ($arTmpShoppingCart as $arCartItem)
							{
								if (CSaleBasketHelper::isSetItem($arCartItem))
									continue;

								$arCartWithoutSetItems[] = $arCartItem;
							}
						}
						$arShoppingCart = fDeleteDoubleProduct($arCartWithoutSetItems, $arFilterRecommended, 'N');
						if (empty($arShoppingCart["ITEMS"]))
							$displayNoneBasket = "none";
开发者ID:ASDAFF,项目名称:entask.ru,代码行数:30,代码来源:order_new.php

示例3: array

									if ($recomCnt > 2)
									{
										$arTmp = array();
										$arTmp[] = $arRecommendedResult[0];
										$arTmp[] = $arRecommendedResult[1];
										$arRecommendedResult = $arTmp;
									}
									if ($recomCnt <= 0)
										$displayNone = "none";

									$arErrors = array();
									$arFuserItems = CSaleUser::GetList(array("USER_ID" => intval($arOrder["USER_ID"])));

									$arCartWithoutSetItems = array();
									$arTmpShoppingCart = CSaleBasket::DoGetUserShoppingCart($arOrder["LID"], $arOrder["USER_ID"], $arFuserItems["ID"], $arErrors, array());
									if (is_array($arTmpShoppingCart))
									{
										foreach ($arTmpShoppingCart as $arCartItem)
										{
											if (CSaleBasketHelper::isSetItem($arCartItem))
												continue;

											$arCartWithoutSetItems[] = $arCartItem;
										}
									}
									$basketCnt = count($arCartWithoutSetItems);
									if ($basketCnt > 2)
									{
										$arTmp = array();
										$arTmp[] = $arCartWithoutSetItems[0];
开发者ID:akniyev,项目名称:arteva.ru,代码行数:30,代码来源:order_detail.php

示例4: processOrderAcceptRequest

 protected function processOrderAcceptRequest($arPostData)
 {
     $arResult = array();
     DiscountCompatibility::reInit(DiscountCompatibility::MODE_EXTERNAL, array('SITE_ID' => $this->siteId));
     if ($this->checkOrderAcceptStructure($arPostData)) {
         $dbRes = \Bitrix\Sale\TradingPlatform\OrderTable::getList(array("filter" => array("TRADING_PLATFORM_ID" => YandexMarket::getInstance()->getId(), "EXTERNAL_ORDER_ID" => $arPostData["order"]["id"])));
         if (!($orderCorrespondence = $dbRes->fetch())) {
             require_once $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/sale/general/admin_tool.php";
             $arProducts = array();
             foreach ($arPostData["order"]["items"] as $arItem) {
                 $arProduct = $this->getProductById($arItem["offerId"], $arItem["count"]);
                 $arProduct["PRODUCT_ID"] = $arItem["offerId"];
                 $arProduct["MODULE"] = "catalog";
                 $arProduct["PRODUCT_PROVIDER_CLASS"] = "CCatalogProductProvider";
                 $dbIblockElement = CIBlockElement::GetList(array(), array("ID" => $arItem["offerId"]), false, false, array('XML_ID', 'IBLOCK_EXTERNAL_ID'));
                 if ($IblockElement = $dbIblockElement->Fetch()) {
                     if (strlen($IblockElement["XML_ID"]) > 0) {
                         $arProduct["PRODUCT_XML_ID"] = $IblockElement["XML_ID"];
                     }
                     if (strlen($IblockElement["IBLOCK_EXTERNAL_ID"]) > 0) {
                         $arProduct["CATALOG_XML_ID"] = $IblockElement["IBLOCK_EXTERNAL_ID"];
                     }
                 }
                 if ($arProduct["CAN_BUY"] == "Y") {
                     $arProducts[] = $arProduct;
                 }
             }
             $arOrderProductPrice = fGetUserShoppingCart($arProducts, $this->siteId, "N");
             $arErrors = array();
             $userId = intval(CSaleUser::GetAnonymousUserID());
             $arShoppingCart = CSaleBasket::DoGetUserShoppingCart($this->siteId, $userId, $arOrderProductPrice, $arErrors);
             $deliveryId = $arPostData["order"]["delivery"]["id"];
             $paySystemId = $this->mapPaySystems[$arPostData["order"]["paymentMethod"]];
             $locationId = $this->locationMapper->getLocationByCityName($arPostData["order"]["delivery"]["region"]["name"]);
             if ($locationId === false) {
                 $this->log(self::LOG_LEVEL_INFO, "YMARKET_LOCATION_MAPPING", $arPostData["order"]["delivery"]["region"]["name"], GetMessage("SALE_YMH_LOCATION_NOT_FOUND"));
             }
             $arErrors = $arWarnings = array();
             $arOptions = array();
             $arOrderPropsValues = $this->makeAdditionalOrderProps($arPostData["order"]["delivery"]["address"], array(), $this->mapPaySystems[$arPostData["order"]["paymentMethod"]], $arPostData["order"]["delivery"]["id"], $locationId);
             $CSaleOrder = new CSaleOrder();
             $arOrder = $CSaleOrder->DoCalculateOrder($this->siteId, $userId, $arShoppingCart, $this->personTypeId, $arOrderPropsValues, $deliveryId, $paySystemId, $arOptions, $arErrors, $arWarnings);
             $arErrors = array();
             $arAdditionalFields = array("XML_ID" => self::XML_ID_PREFIX . $arPostData["order"]["id"]);
             $arOrder["LID"] = $this->siteId;
             if (isset($arPostData["order"]["notes"])) {
                 $arAdditionalFields["USER_DESCRIPTION"] = $arPostData["order"]["notes"];
             }
             $orderID = $CSaleOrder->DoSaveOrder($arOrder, $arAdditionalFields, 0, $arErrors);
             $res = \Bitrix\Sale\TradingPlatform\OrderTable::add(array("ORDER_ID" => $orderID, "TRADING_PLATFORM_ID" => YandexMarket::getInstance()->getId(), "EXTERNAL_ORDER_ID" => $arPostData["order"]["id"]));
             if (!$res->isSuccess()) {
                 foreach ($res->getErrors() as $error) {
                     $this->log(self::LOG_LEVEL_ERROR, "YMARKET_PLATFORM_ORDER_ADD_ERROR", $orderID, $error);
                 }
             }
         } else {
             $orderID = $orderCorrespondence["ORDER_ID"];
         }
         if (intval($orderID > 0)) {
             $arResult["order"]["accepted"] = true;
             $arResult["order"]["id"] = strval($orderID);
             $this->log(self::LOG_LEVEL_INFO, "YMARKET_ORDER_CREATE", $arPostData["order"]["id"], GetMessage("SALE_YMH_ORDER_CREATED") . " " . $orderID);
         } else {
             $arResult["order"]["accepted"] = false;
             $arResult["order"]["reason"] = "OUT_OF_DATE";
             $this->log(self::LOG_LEVEL_ERROR, "YMARKET_ORDER_CREATE", $arPostData["order"]["id"], print_r($arErrors, true));
         }
     } else {
         $arResult = $this->processError(self::ERROR_STATUS_400, GetMessage("SALE_YMH_ERROR_BAD_STRUCTURE"));
     }
     return $arResult;
 }
开发者ID:akniyev,项目名称:itprom_dobrohost,代码行数:72,代码来源:ym_handler.php

示例5: str_replace

                 $userNew = str_replace("#FIO#", "(" . $arUser["LOGIN"] . ") " . $payerName, GetMessage("NEWO_BUYER_REG_OK"));
                 CUser::SendUserInfo($user_id, SITE_ID, $userNew, true);
             }
         } else {
             foreach ($arErrors as $val) {
                 $errorMessage .= $val["TEXT"] . "<br>";
             }
         }
     }
 }
 /*
  * calc busket
  */
 $arErrors = array();
 $arWarnings = array();
 $arShoppingCart = CSaleBasket::DoGetUserShoppingCart(SITE_ID, IntVal($USER->GetID()), IntVal(CSaleBasket::GetBasketUserID()), $arErrors, $arCupon);
 $productLimit = "";
 $arSelect = array("ID", "IBLOCK_ID", "IBLOCK_SECTION_ID", "CATALOG_QUANTITY");
 if (strlen($_REQUEST["BasketRefresh"]) > 0 || strlen($_REQUEST["BasketOrder"]) > 0 || strlen($_REQUEST["AJAX_CALL"]) > 0) {
     foreach ($arShoppingCart as $key => $val) {
         $rsElement = CIBlockElement::GetList(array(), array("ID" => $val["PRODUCT_ID"], "ACTIVE" => "Y"), false, false, $arSelect);
         $arElement = $rsElement->GetNext();
         if ($_POST["QUANTITY_" . $val["ID"]] > 0) {
             if ($arParams['QUANTITY_FLOAT'] == 'Y') {
                 $_POST["QUANTITY_" . $val["ID"]] = str_replace(",", ".", $_POST["QUANTITY_" . $val["ID"]]);
             }
             $quantityUser = $arParams['QUANTITY_FLOAT'] == 'Y' ? DoubleVal($_POST["QUANTITY_" . $val["ID"]]) : IntVal($_POST["QUANTITY_" . $val["ID"]]);
             //limit qauntity order
             if (count($arElement) > 1 && $arElement["CATALOG_QUANTITY_TRACE"] == "Y") {
                 $quantityCatalog = $arParams['QUANTITY_FLOAT'] == 'Y' ? DoubleVal($arElement["CATALOG_QUANTITY"]) : IntVal($arElement["CATALOG_QUANTITY"]);
                 if ($quantityUser > $quantityCatalog) {
开发者ID:k-kalashnikov,项目名称:geekcon_new,代码行数:31,代码来源:component.php

示例6: Add


//.........这里部分代码省略.........
             }
             if (!isset($productRow['MEASURE_CODE']) || intval($productRow['MEASURE_CODE']) <= 0) {
                 if ($defaultMeasure === null) {
                     $defaultMeasure = \Bitrix\Crm\Measure::getDefaultMeasure();
                 }
                 if (is_array($defaultMeasure)) {
                     $productRow['MEASURE_CODE'] = $defaultMeasure['CODE'];
                     $productRow['MEASURE_NAME'] = $defaultMeasure['SYMBOL'];
                 }
             }
             if (isset($productRow['MEASURE_CODE']) && intval($productRow['MEASURE_CODE']) > 0 && ($bRefreshMeasureName || !array_key_exists('MEASURE_NAME', $productRow) || empty($productRow['MEASURE_NAME']))) {
                 $measure = \Bitrix\Crm\Measure::getMeasureByCode($productRow['MEASURE_CODE']);
                 if (is_array($measure) && isset($measure['SYMBOL'])) {
                     $productRow['MEASURE_NAME'] = $measure['SYMBOL'];
                 }
                 unset($measure);
             }
             $i++;
         }
         unset($productRow, $productMeasures, $catalogXmlId, $productXmlId);
         $arOrderProductPrice = self::__fGetUserShoppingCart($arProduct, $siteId, 'N');
         foreach ($arOrderProductPrice as &$arItem) {
             $arItem["ID_TMP"] = $arItem["ID"];
             $arItem["NAME_TMP"] = $arItem["NAME"];
             unset($arItem["ID"]);
         }
         unset($arItem);
         // user id for order
         $saleUserId = intval(CSaleUser::GetAnonymousUserID());
         if ($saleUserId <= 0) {
             return false;
         }
         $arErrors = array();
         $arShoppingCart = CSaleBasket::DoGetUserShoppingCart($siteId, $saleUserId, $arOrderProductPrice, $arErrors, array(), $tmpOrderId);
         if (!is_array($arShoppingCart) || count($arShoppingCart) === 0) {
             $GLOBALS['APPLICATION']->ThrowException(GetMessage('CRM_ERROR_EMPTY_INVOICE_SPEC'));
             return false;
         }
         foreach ($arShoppingCart as $key => &$arItem) {
             $arItem["ID"] = $arItem["ID_TMP"];
             $arItem["NAME"] = $arItem["NAME_TMP"];
             unset($arItem["NAME_TMP"], $arItem["ID_TMP"]);
             //$arShoppingCart[$key]["ID"] = $arItem["ID"];
         }
         unset($key, $arItem);
         // </editor-fold>
         // person type
         $personTypeId = 0;
         if (!isset($arFields['PERSON_TYPE_ID']) || intval($arFields['PERSON_TYPE_ID']) <= 0) {
             $arPersonTypes = CCrmPaySystem::getPersonTypeIDs();
             if (isset($arPersonTypes['CONTACT'])) {
                 $personTypeId = intval($arPersonTypes['CONTACT']);
             }
         } else {
             $personTypeId = $arFields['PERSON_TYPE_ID'];
         }
         if ($personTypeId <= 0) {
             return false;
         }
         // preparing order to save
         // <editor-fold defaultstate="collapsed" desc="preparing order to save ...">
         $arOrderPropsValues = array();
         if (isset($arFields['INVOICE_PROPERTIES']) && is_array($arFields['INVOICE_PROPERTIES']) && count($arFields['INVOICE_PROPERTIES']) > 0) {
             $arOrderPropsValues = $arFields['INVOICE_PROPERTIES'];
         }
         if (isset($arFields['INVOICE_PROPERTIES'])) {
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:67,代码来源:crm_invoice.php

示例7: Calculate

 public static function Calculate($productRows, $currencyID, $personTypeID, $enableSaleDiscount = false, $siteId = SITE_ID, $arOptions = array())
 {
     if (!CModule::IncludeModule('sale')) {
         return array('err' => '1');
     }
     $saleUserId = intval(CSaleUser::GetAnonymousUserID());
     if ($saleUserId <= 0) {
         return array('err' => '2');
     }
     if (!is_array($productRows) && empty($productRows)) {
         return array('err' => '3');
     }
     $bTaxMode = CCrmTax::isTaxMode();
     if ($bTaxMode) {
         foreach ($productRows as &$productRow) {
             $productRow['TAX_RATE'] = 0.0;
             $productRow['TAX_INCLUDED'] = 'N';
         }
         unset($productRow);
     }
     $cartItems = self::PrepareShoppingCartItems($productRows, $currencyID, $siteId);
     foreach ($cartItems as &$item) {
         $item['ID_TMP'] = $item['ID'];
         unset($item['ID']);
     }
     unset($item);
     $errors = array();
     $cartItems = CSaleBasket::DoGetUserShoppingCart($siteId, $saleUserId, $cartItems, $errors, array(), 0, true);
     foreach ($cartItems as &$item) {
         $item['ID'] = $item['ID_TMP'];
         unset($item['ID_TMP']);
     }
     unset($item);
     $personTypeID = intval($personTypeID);
     if ($personTypeID <= 0) {
         $personTypes = CCrmPaySystem::getPersonTypeIDs();
         if (isset($personTypes['CONTACT'])) {
             $personTypeID = intval($personTypes['CONTACT']);
         }
     }
     if ($personTypeID <= 0) {
         return array('err' => '4');
     }
     $orderPropsValues = array();
     $paySystemId = 0;
     if (is_array($arOptions) && !empty($arOptions)) {
         if (isset($arOptions['LOCATION_ID']) && CCrmTax::isTaxMode()) {
             $locationPropertyID = self::getLocationPropertyId($personTypeID);
             if ($locationPropertyID !== false) {
                 $orderPropsValues[$locationPropertyID] = $arOptions['LOCATION_ID'];
             }
         }
         if (isset($arOptions['PAY_SYSTEM_ID'])) {
             $paySystemId = intval($arOptions['PAY_SYSTEM_ID']);
         }
     }
     $warnings = array();
     $options = array('CURRENCY' => $currencyID);
     if (!$enableSaleDiscount) {
         $options['CART_FIX'] = 'Y';
     }
     return CSaleOrder::DoCalculateOrder($siteId, $saleUserId, $cartItems, $personTypeID, $orderPropsValues, 0, $paySystemId, $options, $errors, $warnings);
 }
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:63,代码来源:sale_helper.php


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