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


PHP CSaleUser::GetUserID方法代码示例

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


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

示例1: createProviderBasketMap

 /**
  * @param array $basketList
  * @param array $select
  * @return array
  * @throws ObjectNotFoundException
  */
 protected static function createProviderBasketMap(array $basketList, array $select = array())
 {
     $basketProviderMap = array();
     /**
      * @var string $basketKey
      * @var BasketItem $basketItem
      */
     foreach ($basketList as $basketIndex => $basketItemDat) {
         if (is_array($basketItemDat) && isset($basketItemDat['BASKET_ITEM'])) {
             $basketItem = $basketItemDat['BASKET_ITEM'];
         } else {
             $basketItem = $basketItemDat;
         }
         $basketProviderData = array('BASKET_ITEM' => $basketItem, 'BASKET_ID' => $basketItem->getId(), 'BASKET_CODE' => $basketItem->getBasketCode(), 'PRODUCT_ID' => $basketItem->getProductId(), 'MODULE' => $basketItem->getField('MODULE'));
         if ($provider = $basketItem->getProvider()) {
             $basketProviderData['PROVIDER'] = $provider;
         } elseif (strval($basketItem->getField('CALLBACK_FUNC')) != '' || strval($basketItem->getField('PAY_CALLBACK_FUNC')) != '') {
             $basketProviderData['CALLBACK_FUNC'] = strval($basketItem->getField('CALLBACK_FUNC')) != '' ? $basketItem->getField('CALLBACK_FUNC') : $basketItem->getField('PAY_CALLBACK_FUNC');
         } else {
             continue;
         }
         if (in_array('QUANTITY', $select)) {
             $basketProviderData['QUANTITY'] = $basketItem->getQuantity();
             // ????
         }
         if (in_array('RENEWAL', $select)) {
             $basketProviderData['RENEWAL'] = $basketItem->getField('RENEWAL') !== null && $basketItem->getField('RENEWAL') != 'N' ? 'Y' : 'N';
         }
         if (in_array('RESERVED', $select)) {
             $basketProviderData['RESERVED'] = $basketItemDat['RESERVED'];
         }
         if (in_array('SITE_ID', $select)) {
             $basketProviderData['SITE_ID'] = $basketItem->getField('LID');
         }
         if (in_array('ORDER_ID', $select)) {
             /** @var Basket $basket */
             if (!($basket = $basketItem->getCollection())) {
                 throw new ObjectNotFoundException('Entity "Basket" not found');
             }
             if ($basket->getOrder() && $basket->getOrderId() > 0) {
                 $basketProviderData['ORDER_ID'] = $basket->getOrderId();
             }
         }
         if (in_array('USER_ID', $select)) {
             /** @var Basket $basket */
             if (!($basket = $basketItem->getCollection())) {
                 throw new ObjectNotFoundException('Entity "Basket" not found');
             }
             if ($order = $basket->getOrder()) {
                 $userId = $order->getUserId();
                 if ($userId === null) {
                     $userId = \CSaleUser::GetUserID($basket->getFUserId());
                 }
                 if ($userId > 0) {
                     $basketProviderData['USER_ID'] = $userId;
                 }
             }
         }
         if (in_array('PAID', $select)) {
             /** @var Basket $basket */
             if (!($basket = $basketItem->getCollection())) {
                 throw new ObjectNotFoundException('Entity "Basket" not found');
             }
             if ($basket->getOrder() && $basket->getOrderId() > 0) {
                 $order = $basket->getOrder();
                 $basketProviderData['PAID'] = $order->isPaid();
             }
         }
         $basketProviderMap[$basketIndex] = $basketProviderData;
     }
     return $basketProviderMap;
 }
开发者ID:Satariall,项目名称:izurit,代码行数:78,代码来源:providerbase.php

示例2: Delete

 function Delete($ID)
 {
     global $DB;
     $ID = intval($ID);
     if (0 >= $ID) {
         return false;
     }
     $rsBaskets = CSaleBasket::GetList(array(), array('ID' => $ID), false, false, array('ID', 'ORDER_ID', 'PRODUCT_ID', 'NAME', 'SUBSCRIBE', 'FUSER_ID', 'TYPE', 'SET_PARENT_ID'));
     if (!($arBasket = $rsBaskets->Fetch())) {
         return false;
     }
     foreach (GetModuleEvents("sale", "OnBeforeBasketDelete", true) as $arEvent) {
         if (ExecuteModuleEventEx($arEvent, array($ID)) === false) {
             return false;
         }
     }
     if (CSaleBasketHelper::isSetParent($arBasket)) {
         $rsSetItems = CSaleBasket::GetList(array(), array("SET_PARENT_ID" => $ID, "TYPE" => ""), false, false, array('ID', 'ORDER_ID', 'PRODUCT_ID', 'NAME', 'SUBSCRIBE', 'FUSER_ID', 'TYPE', 'SET_PARENT_ID'));
         while ($arSetItem = $rsSetItems->GetNext()) {
             CSaleBasket::Delete($arSetItem["ID"]);
         }
     }
     if (0 < intval($arBasket["ORDER_ID"])) {
         CSaleOrderChange::AddRecord($arBasket["ORDER_ID"], "BASKET_REMOVED", array("PRODUCT_ID" => $arBasket["PRODUCT_ID"], "NAME" => $arBasket["NAME"]));
     }
     $DB->Query("DELETE FROM b_sale_basket_props WHERE BASKET_ID = " . $ID, true);
     if (intval($_SESSION["SALE_BASKET_NUM_PRODUCTS"][SITE_ID]) > 0 && !CSaleBasketHelper::isSetItem($arBasket)) {
         $_SESSION["SALE_BASKET_NUM_PRODUCTS"][SITE_ID]--;
     }
     $DB->Query("DELETE FROM b_sale_store_barcode WHERE BASKET_ID = " . $ID, true);
     $DB->Query("DELETE FROM b_sale_basket WHERE ID = " . $ID, true);
     if ('Y' == $arBasket['SUBSCRIBE'] && array_key_exists('NOTIFY_PRODUCT', $_SESSION)) {
         $intUserID = CSaleUser::GetUserID($arBasket['FUSER_ID']);
         if ($intUserID && array_key_exists($intUserID, $_SESSION['NOTIFY_PRODUCT'])) {
             if (array_key_exists($arBasket['PRODUCT_ID'], $_SESSION['NOTIFY_PRODUCT'][$intUserID])) {
                 unset($_SESSION['NOTIFY_PRODUCT'][$intUserID][$arBasket['PRODUCT_ID']]);
             }
         }
     }
     foreach (GetModuleEvents("sale", "OnBasketDelete", true) as $arEvent) {
         ExecuteModuleEventEx($arEvent, array($ID));
     }
     return true;
 }
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:44,代码来源:basket.php

示例3: Delete

 /**
  * <p>Метод удаляет запись корзины с кодом ID. Метод динамичный.</p> <a name="examples"></a>
  *
  *
  * @param int $ID  
  *
  * @return bool 
  *
  * <h4>Example</h4> 
  * <pre>
  * &lt;?
  * if (CSaleBasket::Delete(22))
  *     echo "Запись успешно удалена";
  * ?&gt;
  * </htmМетод может использоваться и для удаления записей корзин, которые уже превращены в заказы. То есть, мы можем удалить запись из состава заказа. Но следует помнить, что после использования метода необходимо обновлять итоговую сумму заказа, например, так: 
  * 
  * 
  *  $contents = array();
  *  $dbBasketItems = CSaleBasket::GetList(
  *             array(
  *                "NAME" =&gt; "ASC",
  *                "ID" =&gt; "ASC"
  *             ),
  *             array(
  *               "LID" =&gt; SITE_ID,
  *               "ORDER_ID" =&gt; $order_id,
  *             )
  *          );
  *   while ($arItems = $dbBasketItems-&gt;Fetch()){
  *             $contents[] = $arItems;
  *          }
  *   $sum = 0;
  *   foreach($contents as $basket_item){
  *             if($basket_item['DISCOUNT_PRICE']&gt;0){
  *                $sum += $basket_item['DISCOUNT_PRICE']*$basket_item['QUANTITY'];
  *             }else{
  *                $sum += $basket_item['PRICE']*$basket_item['QUANTITY'];
  *             }
  *          }
  *    $arFields = array(
  *             "PRICE" =&gt; $sum,
  *          );
  *    CSaleOrder::Update($order_id, $arFields);
  * </pre>
  *
  *
  * @static
  * @link http://dev.1c-bitrix.ru/api_help/sale/classes/csalebasket/csalebasket__delete.e0d06223.php
  * @author Bitrix
  */
 public static function Delete($ID)
 {
     global $DB, $APPLICATION;
     $isOrderConverted = \Bitrix\Main\Config\Option::get("main", "~sale_converted_15", 'N');
     $ID = intval($ID);
     if (0 >= $ID) {
         return false;
     }
     if ($isOrderConverted == "Y") {
         /** @var \Bitrix\Sale\Result $r */
         $r = \Bitrix\Sale\Compatible\BasketCompatibility::delete($ID);
         if (!$r->isSuccess(true)) {
             foreach ($r->getErrorMessages() as $error) {
                 $APPLICATION->ThrowException($error);
             }
             return false;
         }
         return true;
     }
     $rsBaskets = CSaleBasket::GetList(array(), array('ID' => $ID), false, false, array('ID', 'ORDER_ID', 'PRODUCT_ID', 'NAME', 'SUBSCRIBE', 'FUSER_ID', 'TYPE', 'SET_PARENT_ID'));
     if (!($arBasket = $rsBaskets->Fetch())) {
         return false;
     }
     foreach (GetModuleEvents("sale", "OnBeforeBasketDelete", true) as $arEvent) {
         if (ExecuteModuleEventEx($arEvent, array($ID)) === false) {
             return false;
         }
     }
     if (CSaleBasketHelper::isSetParent($arBasket)) {
         $rsSetItems = CSaleBasket::GetList(array(), array("SET_PARENT_ID" => $ID, "TYPE" => ""), false, false, array('ID', 'ORDER_ID', 'PRODUCT_ID', 'NAME', 'SUBSCRIBE', 'FUSER_ID', 'TYPE', 'SET_PARENT_ID'));
         while ($arSetItem = $rsSetItems->GetNext()) {
             CSaleBasket::Delete($arSetItem["ID"]);
         }
     }
     if (0 < intval($arBasket["ORDER_ID"])) {
         CSaleOrderChange::AddRecord($arBasket["ORDER_ID"], "BASKET_REMOVED", array("PRODUCT_ID" => $arBasket["PRODUCT_ID"], "NAME" => $arBasket["NAME"]));
     }
     $DB->Query("DELETE FROM b_sale_basket_props WHERE BASKET_ID = " . $ID, true);
     if (intval($_SESSION["SALE_BASKET_NUM_PRODUCTS"][SITE_ID]) > 0 && !CSaleBasketHelper::isSetItem($arBasket)) {
         $_SESSION["SALE_BASKET_NUM_PRODUCTS"][SITE_ID]--;
     }
     $DB->Query("DELETE FROM b_sale_store_barcode WHERE BASKET_ID = " . $ID, true);
     $DB->Query("DELETE FROM b_sale_basket WHERE ID = " . $ID, true);
     if ('Y' == $arBasket['SUBSCRIBE'] && array_key_exists('NOTIFY_PRODUCT', $_SESSION)) {
         $intUserID = CSaleUser::GetUserID($arBasket['FUSER_ID']);
         if ($intUserID && array_key_exists($intUserID, $_SESSION['NOTIFY_PRODUCT'])) {
             if (array_key_exists($arBasket['PRODUCT_ID'], $_SESSION['NOTIFY_PRODUCT'][$intUserID])) {
                 unset($_SESSION['NOTIFY_PRODUCT'][$intUserID][$arBasket['PRODUCT_ID']]);
             }
         }
//.........这里部分代码省略.........
开发者ID:andy-profi,项目名称:bxApiDocs,代码行数:101,代码来源:basket.php

示例4: Delete

	/**
	 * <p>Функция удаляет запись корзины с кодом ID. </p> <a name="examples"></a>
	 *
	 *
	 *
	 *
	 * @param int $ID  
	 *
	 *
	 *
	 * @return bool 
	 *
	 *
	 * <h4>Example</h4> 
	 * <pre>
	 * &lt;?
	 * if (CSaleBasket::Delete(22))
	 *     echo "Запись успешно удалена";
	 * ?&gt;
	 * </pre>
	 *
	 *
	 * @static
	 * @link http://dev.1c-bitrix.ru/api_help/sale/classes/csalebasket/csalebasket__delete.e0d06223.php
	 * @author Bitrix
	 */
	public static function Delete($ID)
	{
		global $DB;

		$ID = intval($ID);
		if (0 >= $ID)
			return false;

		$rsBaskets = CSaleBasket::GetList(
			array(),
			array('ID' => $ID),
			false,
			false,
			array(
				'ID',
				'ORDER_ID',
				'PRODUCT_ID',
				'NAME',
				'SUBSCRIBE',
				'FUSER_ID'
			)
		);
		if (!($arBasket = $rsBaskets->Fetch()))
			return false;

		foreach(GetModuleEvents("sale", "OnBeforeBasketDelete", true) as $arEvent)
			if (ExecuteModuleEventEx($arEvent, array($ID))===false)
				return false;

		if (0 < intval($arBasket["ORDER_ID"]))
			CSaleOrderChange::AddRecord($arBasket["ORDER_ID"], "BASKET_REMOVED", array("PRODUCT_ID" => $arBasket["PRODUCT_ID"], "NAME" => $arBasket["NAME"]));

		$DB->Query("DELETE FROM b_sale_basket_props WHERE BASKET_ID = ".$ID, true);
		if(intval($_SESSION["SALE_BASKET_NUM_PRODUCTS"][SITE_ID]) > 0 )
			$_SESSION["SALE_BASKET_NUM_PRODUCTS"][SITE_ID]--;

		$DB->Query("DELETE FROM b_sale_store_barcode WHERE BASKET_ID = ".$ID, true);

		$DB->Query("DELETE FROM b_sale_basket WHERE ID = ".$ID, true);

		if ('Y' == $arBasket['SUBSCRIBE'] && array_key_exists('NOTIFY_PRODUCT', $_SESSION))
		{
			$intUserID = CSaleUser::GetUserID($arBasket['FUSER_ID']);
			if ($intUserID && array_key_exists($intUserID, $_SESSION['NOTIFY_PRODUCT']))
			{
				if (array_key_exists($arBasket['PRODUCT_ID'], $_SESSION['NOTIFY_PRODUCT'][$intUserID]))
				{
					unset($_SESSION['NOTIFY_PRODUCT'][$intUserID][$arBasket['PRODUCT_ID']]);
				}
			}
		}

		foreach(GetModuleEvents("sale", "OnBasketDelete", true) as $arEvent)
			ExecuteModuleEventEx($arEvent, array($ID));

		return true;
	}
开发者ID:ASDAFF,项目名称:bxApiDocs,代码行数:83,代码来源:basket.php


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