• Модуль: catalog
  • Путь к файлу: ~/bitrix/modules/catalog/lib/discount/discountmanager.php
  • Класс: BitrixCatalogDiscountDiscountManager
  • Вызов: DiscountManager::loadSections
static function loadSections(array $productIds): array
{
	$productSection = array_fill_keys($productIds, []);
	$elementSectionIterator = IblockSectionElementTable::getList([
		'select' => ['*'],
		'filter' => ['@IBLOCK_ELEMENT_ID' => $productIds]
	]);
	while ($elementSection = $elementSectionIterator->fetch())
	{
		$elementSection['IBLOCK_ELEMENT_ID'] = (int)$elementSection['IBLOCK_ELEMENT_ID'];
		$elementSection['IBLOCK_SECTION_ID'] = (int)$elementSection['IBLOCK_SECTION_ID'];
		$elementSection['ADDITIONAL_PROPERTY_ID'] = (int)$elementSection['ADDITIONAL_PROPERTY_ID'];
		if ($elementSection['ADDITIONAL_PROPERTY_ID'] > 0)
			continue;
		$productSection[$elementSection['IBLOCK_ELEMENT_ID']][$elementSection['IBLOCK_SECTION_ID']] = true;
		$parentSectionIterator = CIBlockSection::GetNavChain(0, $elementSection['IBLOCK_SECTION_ID'], ['ID']);
		while ($parentSection = $parentSectionIterator->fetch())
		{
			$parentSection['ID'] = (int)$parentSection['ID'];
			$productSection[$elementSection['IBLOCK_ELEMENT_ID']][$parentSection['ID']] = true;
		}
		unset($parentSection, $parentSectionIterator);
	}
	unset($elementSection, $elementSectionIterator);

	return $productSection;
}