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


PHP CSaleUser::GetAnonymousUserID方法代码示例

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


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

示例1: getEdit

    public static function getEdit(Order $order, $showProfiles = false)
    {
        $data = self::prepareData($order);
        $result = '
			<div class="adm-bus-table-container">
				<table border="0" cellspacing="0" cellpadding="0" width="100%" class="adm-detail-content-table edit-table">
					<tbody>
						<tr' . (intval($data["USER_ID"]) > 0 && $data["USER_ID"] != \CSaleUser::GetAnonymousUserID() ? ' style="display: none"' : '') . ' id="sale-order-buyer-find-button-wrap">
							<td class="adm-detail-content-cell-l fwb" width="40%">
								&nbsp;
							</td>
							<td class="adm-detail-content-cell-r">
								<input type="button" name="FIND_BUYER" value="' . Loc::getMessage("SALE_ORDER_BUYER_FIND") . '" onclick="BX.Sale.Admin.OrderBuyer.showChooseBuyerWindow(\'' . LANGUAGE_ID . '\')"><br>
								<i>' . Loc::getMessage("SALE_ORDER_BUYER_START_TO_CREATE") . ':</i>
							</td>
						</tr>
						<tr' . (intval($data["USER_ID"]) <= 0 || $data["USER_ID"] == \CSaleUser::GetAnonymousUserID() ? ' style="display: none"' : '') . ' id="sale-order-buyer-name-wrap">
							<td class="adm-detail-content-cell-l" width="40%">' . Loc::getMessage("SALE_ORDER_BUYER") . ':</td>
							<td class="adm-detail-content-cell-r">
								<div class="adm-s-order-person-choose">
									<a id="BUYER_USER_NAME" href="/bitrix/admin/user_edit.php?lang=' . LANGUAGE_ID . '&ID=' . $data["USER_ID"] . '">' . htmlspecialcharsbx($data["BUYER_USER_NAME"]) . '</a>&nbsp;
									<a class="adm-s-bus-morelinkqhsw" onclick="BX.Sale.Admin.OrderBuyer.showChooseBuyerWindow(\'' . LANGUAGE_ID . '\')" href="javascript:void(0);">
										' . Loc::getMessage("SALE_ORDER_BUYER_CHANGE") . '
									</a>&nbsp;
									<a class="adm-s-bus-morelinkqhsw" onclick="BX.Sale.Admin.OrderBuyer.clearBuyer();" href="javascript:void(0);">
										' . Loc::getMessage("SALE_ORDER_BUYER_CLEAR") . '
									</a>
									<input type="hidden" name="USER_ID" id="USER_ID" value="' . $data["USER_ID"] . '" onchange="BX.Sale.Admin.OrderBuyer.onBuyerIdChange(this);">
								</div>
							</td>
						</tr>
						<tr>
							<td class="adm-detail-content-cell-l fwb">' . Loc::getMessage("SALE_ORDER_BUYER_PAYER_TYPE") . ':</td>
							<td class="adm-detail-content-cell-r">' . \Bitrix\Sale\Helpers\Admin\OrderEdit::makeSelectHtml("PERSON_TYPE_ID", self::getBuyerTypesList($order->getSiteId()), isset($data["PERSON_TYPE_ID"]) ? $data["PERSON_TYPE_ID"] : "", false, array("class" => "adm-bus-select", "id" => "PERSON_TYPE_ID", "onchange" => "BX.Sale.Admin.OrderBuyer.onBuyerTypeChange(this.value);")) . '</td>
						</tr>
						<tr id="sale-order-buyer-profiles-list-row"' . ($showProfiles ? '' : ' style="display:none;"') . '>
							<td class="adm-detail-content-cell-l">' . Loc::getMessage("SALE_ORDER_BUYER_CHOOSE_PROFILE") . ':</td>
							<td class="adm-detail-content-cell-r"><div id="BUYER_PROFILE_ID_CONTAINER">';
        if ($showProfiles) {
            $result .= \Bitrix\Sale\Helpers\Admin\OrderEdit::makeSelectHtml("BUYER_PROFILE_ID", self::getBuyerProfilesList($data["USER_ID"], $data["PERSON_TYPE_ID"]), isset($data["BUYER_PROFILE_ID"]) ? $data["BUYER_PROFILE_ID"] : "", false, array("class" => "adm-bus-select", "id" => "BUYER_PROFILE_ID", "onchange" => "BX.Sale.Admin.OrderBuyer.onBuyerProfileChange();"));
        }
        $result .= '</div></td>
						</tr>
					</tbody>
				</table>
			</div>' . '<div id="order_properties_container"></div>' . '<div>' . self::getOrderPropertiesByJS($order) . '</div>' . '<div class="adm-bus-table-container caption border sale-order-props-group">' . '<div class="adm-bus-table-caption-title">' . Loc::getMessage("SALE_ORDER_BUYER_COMMENT") . '</div>
				<table border="0" cellspacing="0" cellpadding="0" width="100%" class="adm-detail-content-table edit-table ">
					<tbody>
						<tr>
							<td class="adm-detail-content-cell-l" width="40%">' . Loc::getMessage("SALE_ORDER_BUYER_ORDERCOMMENT") . ':</td>
							<td class="adm-detail-content-cell-r">
								<textarea style="width:400px;min-height:100px;" name="USER_DESCRIPTION" id="USER_DESCRIPTION">' . $data["USER_DESCRIPTION"] . '</textarea>
							</td>
						</tr>
					</tbody>
				</table>
			</div>';
        return $result;
    }
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:59,代码来源:orderbuyer.php

示例2: processOrder

 public function processOrder($orderEbay)
 {
     Ebay::log(Logger::LOG_LEVEL_DEBUG, "EBAY_DATA_PROCESSOR_ORDER_PROCESSING", $orderEbay["ExtendedOrderID"], print_r($orderEbay, true), $this->siteId);
     /*
      * only in this case order is completely ready for shipping
      */
     if ($orderEbay["OrderStatus"] != "Completed" || !isset($orderEbay["CheckoutStatus"]["eBayPaymentStatus"]) || $orderEbay["CheckoutStatus"]["eBayPaymentStatus"] != "NoPaymentFailure") {
         Ebay::log(Logger::LOG_LEVEL_INFO, "EBAY_DATA_PROCESSOR_ORDER_SKIPPED", $orderEbay["ExtendedOrderID"], Loc::getMessage("SALE_TP_EBAY_FDPO_ORDER_SKIPPED", array("#ORDER_ID#" => $orderEbay["ExtendedOrderID"])), $this->siteId);
         return array();
     }
     $ebay = \Bitrix\Sale\TradingPlatform\Ebay\Ebay::getInstance();
     $settings = $ebay->getSettings();
     if (!isset($settings[$this->siteId]["ORDER_PROPS"]) || !is_array($settings[$this->siteId]["ORDER_PROPS"])) {
         throw new SystemException("Can't get order props map");
     }
     $propsMap = $settings[$this->siteId]["ORDER_PROPS"];
     /*
     if(strtolower(SITE_CHARSET) != 'utf-8')
     	$orderEbay = \Bitrix\Main\Text\Encoding::convertEncodingArray($orderEbay, 'UTF-8', SITE_CHARSET);
     */
     $dbRes = OrderTable::getList(array("filter" => array("TRADING_PLATFORM_ID" => $ebay->getId(), "EXTERNAL_ORDER_ID" => $orderEbay["ExtendedOrderID"])));
     if ($orderCorrespondence = $dbRes->fetch()) {
         Ebay::log(Logger::LOG_LEVEL_INFO, "EBAY_DATA_PROCESSOR_ORDER_ALREADY_EXIST", $orderEbay["ExtendedOrderID"], Loc::getMessage("SALE_TP_EBAY_FDPO_ORDER_SKIPPED_EXIST", array("#ORDER_ID#" => $orderEbay["ExtendedOrderID"])), $this->siteId);
         return array();
     }
     /** @var \Bitrix\Sale\Order $order */
     $order = \Bitrix\Sale\Order::create($this->siteId);
     $order->setPersonTypeId($settings[$this->siteId]["PERSON_TYPE"]);
     $propsCollection = $order->getPropertyCollection();
     /** @var \Bitrix\Sale\PropertyValueCollection $propCollection */
     if (intval($propsMap["FIO"]) > 0) {
         $prop = $propsCollection->getItemByOrderPropertyId($propsMap["FIO"]);
         $prop->setValue($orderEbay["ShippingAddress"]["Name"]);
     }
     if (intval($propsMap["CITY"]) > 0) {
         $prop = $propsCollection->getItemByOrderPropertyId($propsMap["CITY"]);
         $prop->setValue($orderEbay["ShippingAddress"]["CityName"]);
     }
     if (intval($propsMap["PHONE"]) > 0) {
         $prop = $propsCollection->getItemByOrderPropertyId($propsMap["PHONE"]);
         $prop->setValue($orderEbay["ShippingAddress"]["Phone"]);
     }
     if (intval($propsMap["ZIP"]) > 0) {
         $prop = $propsCollection->getItemByOrderPropertyId($propsMap["ZIP"]);
         $prop->setValue($orderEbay["ShippingAddress"]["PostalCode"]);
     }
     if (intval($propsMap["ADDRESS"]) > 0) {
         $prop = $propsCollection->getItemByOrderPropertyId($propsMap["ADDRESS"]);
         $prop->setValue($orderEbay["ShippingAddress"]["CountryName"] . " " . $orderEbay["ShippingAddress"]["CityName"] . " " . $orderEbay["ShippingAddress"]["Street1"] . " " . (!empty($orderEbay["ShippingAddress"]["Street2"]) ? $orderEbay["ShippingAddress"]["Street2"] . " " : ""));
     }
     $basket = null;
     $bitrixOrderId = 0;
     $userId = 0;
     $orderLineItemsIds = array();
     $transactionsArray = $this->normalizeTransactionsArray($orderEbay["TransactionArray"]);
     foreach ($transactionsArray as $transaction) {
         //if we have more than one transaction let's create user from the first
         if ($userId <= 0) {
             if (intval($propsMap["EMAIL"]) > 0 && !empty($transaction["Buyer"]["Email"])) {
                 $prop = $propsCollection->getItemByOrderPropertyId($propsMap["EMAIL"]);
                 $prop->setValue($transaction["Buyer"]["Email"]);
                 $userId = $this->createUser($transaction["Buyer"]["Email"], array("NAME" => $transaction["Buyer"]["UserFirstName"], "LAST_NAME" => $transaction["Buyer"]["UserLastName"]));
             }
             if ($userId <= 0) {
                 $userId = \CSaleUser::GetAnonymousUserID();
             }
         }
         if (intval($userId > 0)) {
             $order->setFieldNoDemand("USER_ID", $userId);
         }
         $fUserId = null;
         if ($order->getUserId() > 0) {
             $fUserId = Fuser::getIdByUserId($order->getUserId());
         }
         /** @var \Bitrix\Sale\Basket $basket */
         if (!$basket) {
             $basket = \Bitrix\Sale\Basket::create($this->siteId);
             $basket->setFUserId($fUserId);
         }
         $items = array();
         $isVariation = false;
         if (!empty($transaction["Item"])) {
             $items = Xml2Array::normalize($transaction["Item"]);
         } elseif (!empty($transaction["Variation"])) {
             $items = Xml2Array::normalize($transaction["Variation"]);
             $isVariation = true;
         }
         if (empty($items)) {
             Ebay::log(Logger::LOG_LEVEL_INFO, "EBAY_DATA_PROCESSOR_ORDER_PROCESSING_TRANSACTION_ITEM_NOT_FOUND", $transaction["OrderLineItemID"], print_r($transaction, true), $this->siteId);
             continue;
         }
         foreach ($items as $transactionItem) {
             $ebaySku = $isVariation ? $this->getSkuVariation($transactionItem["SKU"]) : $this->getSku($transactionItem["SKU"]);
             if (strlen($ebaySku) <= 0) {
                 Ebay::log(Logger::LOG_LEVEL_INFO, "EBAY_DATA_PROCESSOR_ORDER_PROCESSING_TRANSACTION_ITEM_SKU_NOT_FOUND", $transaction["OrderLineItemID"], print_r($transaction, true), $this->siteId);
                 continue;
             }
             $item = $basket->createItem('catalog', $ebaySku);
             $item->setField("PRODUCT_PROVIDER_CLASS", "CCatalogProductProvider");
             $itemData = array("CUSTOM_PRICE" => "Y", "PRICE" => floatval($transaction["TransactionPrice"]), "QUANTITY" => floatval($transaction["QuantityPurchased"]), "NAME" => !empty($transactionItem["VariationTitle"]) ? $transactionItem["VariationTitle"] : $transactionItem["Title"], "CURRENCY" => SiteCurrencyTable::getSiteCurrency($this->siteId));
//.........这里部分代码省略.........
开发者ID:webgksupport,项目名称:alpina,代码行数:101,代码来源:order.php

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

示例4: addProductToBasketAction

 protected function addProductToBasketAction()
 {
     if (!$this->request["formData"]) {
         throw new ArgumentNullException("formatData");
     }
     if (!$this->request["quantity"]) {
         throw new ArgumentNullException("quantity");
     }
     if (!$this->request["productId"]) {
         throw new ArgumentNullException("productId");
     }
     $productId = isset($this->request['productId']) ? intval($this->request['productId']) : 0;
     $quantity = isset($this->request['quantity']) ? intval($this->request['quantity']) : 1;
     $columns = isset($this->request['columns']) ? $this->request['columns'] : array();
     $alreadyInBasketCode = "";
     $productParams = array();
     if (isset($this->request["formData"]["PRODUCT"]) && is_array($this->request["formData"]["PRODUCT"])) {
         foreach ($this->request["formData"]["PRODUCT"] as $basketCode => &$params) {
             if (!isset($params["MODULE"]) || $params["MODULE"] != "catalog") {
                 continue;
             }
             if (!isset($params["OFFER_ID"]) || $params["OFFER_ID"] != $productId) {
                 continue;
             }
             $params["QUANTITY"] += $quantity;
             $alreadyInBasketCode = $basketCode;
             $productParams = $params;
             break;
         }
     }
     if (empty($productParams)) {
         $productParams = Admin\Blocks\OrderBasket::getProductDetails($productId, $quantity, !empty($this->request["formData"]["USER_ID"]) ? $this->request["formData"]["USER_ID"] : \CSaleUser::GetAnonymousUserID(), isset($this->request["formData"]["SITE_ID"]) ? $this->request["formData"]["SITE_ID"] : SITE_ID, $columns);
     }
     if (isset($this->request["replaceBasketCode"]) && strlen($this->request["replaceBasketCode"]) > 0 && isset($this->request["formData"]["PRODUCT"][$this->request["replaceBasketCode"]])) {
         $this->request["formData"]["PRODUCT"][$this->request["replaceBasketCode"]] = $productParams;
         if (strlen($alreadyInBasketCode) > 0) {
             unset($this->request["formData"]["PRODUCT"][$alreadyInBasketCode]);
         }
     } elseif (strlen($alreadyInBasketCode) <= 0) {
         $this->request["formData"]["PRODUCT"]["new"] = $productParams;
     }
     $this->formDataChanged = true;
 }
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:43,代码来源:order_ajax.php

示例5: HasProductRows

 public static function HasProductRows($productID)
 {
     if (!CModule::IncludeModule('sale')) {
         return false;
     }
     $result = false;
     $saleUserId = intval(CSaleUser::GetAnonymousUserID());
     $CSaleBasket = new CSaleBasket();
     $dbRes = $CSaleBasket->GetList(array(), array('PRODUCT_ID' => $productID, '>ORDER_ID' => 0, 'USER_ID' => $saleUserId), false, array('nTopCount' => 1), array('ID'));
     if (is_object($dbRes)) {
         $arRes = $dbRes->Fetch();
         if (is_array($arRes) && isset($arRes['ID']) && intval($arRes['ID']) > 0) {
             $result = true;
         }
     }
     return $result;
 }
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:17,代码来源:crm_invoice.php

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

示例7: getPropertyByCode

}
function getPropertyByCode($propertyCollection, $code)
{
    foreach ($propertyCollection as $property) {
        if ($property->getField('CODE') == $code) {
            return $property;
        }
    }
}
$siteId = \Bitrix\Main\Context::getCurrent()->getSite();
$fio = 'Пупкин Василий';
$phone = '9511111111';
$email = 'pupkin@mail.ru';
$currencyCode = Option::get('sale', 'default_currency', 'RUB');
DiscountCouponsManager::init();
$order = Order::create($siteId, \CSaleUser::GetAnonymousUserID());
$order->setPersonTypeId(1);
$basket = Sale\Basket::loadItemsForFUser(\CSaleBasket::GetBasketUserID(), $siteId)->getOrderableItems();
/* Действия над товарами
$basketItems = $basket->getBasketItems();
foreach ($basketItems as $basketItem) {
    
}
*/
$order->setBasket($basket);
/*Shipment*/
$shipmentCollection = $order->getShipmentCollection();
$shipment = $shipmentCollection->createItem();
$shipment->setFields(['DELIVERY_ID' => 1, 'CURRENCY' => $currencyCode]);
/**/
/*Payment*/
开发者ID:VitaliiSestrenskyi,项目名称:sest,代码行数:31,代码来源:createOrderD7.php

示例8: saveCoupons

 public static function saveCoupons($userId, $formData)
 {
     if ($userId == \CSaleUser::GetAnonymousUserID()) {
         return false;
     }
     // init discount coupons
     DiscountCouponsManager::init(DiscountCouponsManager::MODE_MANAGER, array("userId" => $userId));
     if (!DiscountCouponsManager::isSuccess()) {
         throw new UserMessageException(print_r(DiscountCouponsManager::getErrors(), true));
     }
     if (isset($formData["COUPONS"]) && strlen($formData["COUPONS"]) > 0) {
         $coupons = explode(",", $formData["COUPONS"]);
         if (is_array($coupons) && count($coupons) > 0) {
             foreach ($coupons as $coupon) {
                 DiscountCouponsManager::add($coupon);
             }
         }
     }
     return true;
 }
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:20,代码来源:orderedit.php


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