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


PHP CSaleBasket::executeCallbackFunction方法代码示例

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


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

示例1: getProductData


//.........这里部分代码省略.........
     $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) {
                     $resultProductData = \CSaleBasket::executeCallbackFunction($providerBasketItem['CALLBACK_FUNC'], $providerBasketItem['MODULE'], $providerBasketItem['PRODUCT_ID'], $providerBasketItem['QUANTITY']);
                     $basketCode = $providerBasketItem['BASKET_ITEM']->getBasketCode();
                     $result[$basketCode] = $resultProductData;
                 }
             }
         }
     }
     return $result;
 }
开发者ID:Satariall,项目名称:izurit,代码行数:101,代码来源:providerbase.php


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