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


PHP CSaleUser::getUserID方法代碼示例

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


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

示例1: getProductData

 /**
  * @param Basket $basketCollection
  * @param array $select
  * @param BasketItem $refreshItem
  * @return array
  * @throws NotSupportedException
  */
 public static function getProductData(Basket $basketCollection, array $select = array(), BasketItem $refreshItem = null)
 {
     $result = array();
     $orderId = null;
     $userId = null;
     $siteId = null;
     $currency = null;
     if (($order = $basketCollection->getOrder()) !== null) {
         $userId = $order->getUserId();
         $siteId = $order->getSiteId();
         $currency = $order->getCurrency();
     }
     if ($userId === null) {
         static $usersIds = array();
         if (empty($usersIds[$basketCollection->getFUserId(true)])) {
             $usersIds[$basketCollection->getFUserId(true)] = \CSaleUser::getUserID($basketCollection->getFUserId(true));
         }
         $userId = $usersIds[$basketCollection->getFUserId(true)];
     }
     if ($siteId === null) {
         $siteId = $basketCollection->getSiteId();
     }
     if ($siteId === null) {
         return array();
     }
     if ($currency === null) {
         $currency = Internals\SiteCurrencyTable::getSiteCurrency($siteId);
         if (!$currency) {
             $currency = Currency\CurrencyManager::getBaseCurrency();
         }
     }
     $basketList = static::makeArrayFromBasketCollection($basketCollection, $refreshItem);
     $basketProviderMap = static::createProviderBasketMap($basketList, array('QUANTITY', 'RENEWAL'));
     $basketProviderList = static::redistributeToProviders($basketProviderMap);
     if (!empty($basketProviderList)) {
         $needPrice = in_array('PRICE', $select);
         $needBasePrice = in_array('BASE_PRICE', $select);
         $needCoupons = in_array('COUPONS', $select);
         $data = array('USER_ID' => (int) $userId, 'SITE_ID' => $siteId, 'CURRENCY' => $currency, 'CHECK_QUANTITY' => in_array('QUANTITY', $select) ? 'Y' : 'N', 'CHECK_PRICE' => $needPrice ? 'Y' : 'N', 'CHECK_COUPONS' => $needCoupons ? 'Y' : 'N', 'RENEWAL' => in_array('RENEWAL', $select) ? 'Y' : 'N');
         if ($needBasePrice) {
             $data['CHECK_DISCOUNT'] = 'N';
         }
         $useOrderProduct = false;
         if ($needPrice) {
             $useOrderProduct = true;
         }
         if ($needCoupons) {
             $useOrderProduct = false;
         }
         unset($needCoupons, $needPrice);
         foreach ($basketProviderList as $provider => $providerBasketItemList) {
             if ($provider instanceof Provider) {
                 throw new NotSupportedException('provider not supported');
             } elseif ($provider && array_key_exists("IBXSaleProductProvider", class_implements($provider))) {
                 foreach ($providerBasketItemList as $providerBasketItem) {
                     $currentUseOrderProduct = $useOrderProduct;
                     if (!isset($providerBasketItem['BASKET_ID']) || (int) $providerBasketItem['BASKET_ID'] <= 0) {
                         $currentUseOrderProduct = false;
                     }
                     $providerFields = $data;
                     if ($providerBasketItem['BASKET_ITEM']->isBundleChild()) {
                         $providerFields['CHECK_DISCOUNT'] = 'N';
                     }
                     $providerFields['PRODUCT_ID'] = $providerBasketItem['PRODUCT_ID'];
                     $providerFields['QUANTITY'] = $providerBasketItem['QUANTITY'];
                     $hasTrustData = false;
                     $trustData = static::getTrustData($siteId, $providerBasketItem['MODULE'], $providerBasketItem['PRODUCT_ID']);
                     if (static::isReadTrustData() === true && !empty($trustData) && is_array($trustData)) {
                         $hasTrustData = true;
                         $resultProductData = $trustData;
                         foreach (static::getProductDataRequiredFields() as $requiredField) {
                             if (!array_key_exists($requiredField, $resultProductData)) {
                                 $hasTrustData = false;
                                 break;
                             }
                         }
                         if ($hasTrustData && in_array('PRICE', $select)) {
                             foreach (static::getProductDataRequiredPriceFields() as $requiredField) {
                                 if (!array_key_exists($requiredField, $resultProductData)) {
                                     $hasTrustData = false;
                                     break;
                                 }
                             }
                         }
                     }
                     if (!$hasTrustData) {
                         $resultProductData = $currentUseOrderProduct ? $provider::OrderProduct($providerFields) : $provider::GetProductData($providerFields);
                     }
                     $basketCode = $providerBasketItem['BASKET_ITEM']->getBasketCode();
                     $result[$basketCode] = $resultProductData;
                 }
             } else {
                 foreach ($providerBasketItemList as $providerBasketItem) {
//.........這裏部分代碼省略.........
開發者ID:Satariall,項目名稱:izurit,代碼行數:101,代碼來源:providerbase.php


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