- Модуль: catalog
- Путь к файлу: ~/bitrix/modules/catalog/lib/discount/discountmanager.php
- Класс: BitrixCatalogDiscountDiscountManager
- Вызов: DiscountManager::preloadProductDataToExtendOrder
static function preloadProductDataToExtendOrder(array $productIds, array $userGroups)
{
if (empty($productIds) || empty($userGroups))
return;
Collection::normalizeArrayValuesByInt($productIds, true);
if (empty($productIds))
return;
Collection::normalizeArrayValuesByInt($userGroups, true);
if (empty($userGroups))
return;
if(self::$saleIncluded === null)
self::$saleIncluded = Loader::includeModule('sale');
if(!self::$saleIncluded)
return;
$discountCache = SaleDiscountRuntimeCacheDiscountCache::getInstance();
$discountIds = $discountCache->getDiscountIds($userGroups);
if(!$discountIds)
{
return;
}
Collection::normalizeArrayValuesByInt($discountIds, true);
$entityList = $discountCache->getDiscountEntities($discountIds);
if(!$entityList || empty($entityList['catalog']))
{
return;
}
$entityData = self::prepareEntity($entityList);
if(!$entityData)
{
return;
}
$productIds = self::extendProductIdsToOffer($productIds);
$iblockData = self::getProductIblocks($productIds);
self::fillProductPropertyList($entityData, $iblockData);
$productData = array_fill_keys($productIds, []);
if(empty($iblockData['iblockElement']))
{
return;
}
self::getProductData($productData, $entityData, $iblockData);
$cacheKeyForEntityList = self::getCacheKeyForEntityList($entityList);
if(!isset(self::$preloadedProductsData[$cacheKeyForEntityList]))
{
self::$preloadedProductsData[$cacheKeyForEntityList] = [];
}
foreach($productData as $productId => $data)
{
self::$preloadedProductsData[$cacheKeyForEntityList][$productId] = $data;
}
}