本文整理汇总了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) {
//.........这里部分代码省略.........