• Модуль: catalog
  • Путь к файлу: ~/bitrix/modules/catalog/lib/config/state.php
  • Класс: BitrixCatalogConfigState
  • Вызов: State::getElementCount
static function getElementCount(int $iblockId): int
{
	if (self::$elementCount === null)
	{
		self::$elementCount = 0;

		$iblockSectionIds = self::getIblockSections($iblockId);
		if (!empty($iblockSectionIds))
		{
			$filter = [
				'IBLOCK_ID' => $iblockId,
				'SECTION_ID' => $iblockSectionIds,
				'INCLUDE_SUBSECTIONS' => 'Y',
				'CHECK_PERMISSIONS' => 'N',
			];
			$filter = CatalogProductSystemFieldProductMapping::getExtendedFilterByArea(
				$filter,
				CatalogProductSystemFieldProductMapping::MAP_LANDING
			);
			self::$elementCount = (int)CIBlockElement::GetList(
				[],
				$filter,
				[],
				false,
				['ID']
			);
		}
		unset($iblockSectionIds);
	}
	return self::$elementCount;
}