• Модуль: iblock
  • Путь к файлу: ~/bitrix/modules/iblock/lib/component/base.php
  • Класс: BitrixIblockComponentBase
  • Вызов: Base::initVats
protected function initVats()
{
	$this->storage['VATS'] = [];
	$this->storage['IBLOCKS_VAT'] = [];
	if ($this->useCatalog)
	{
		$iterator = CatalogVatTable::getList([
			'select' => ['ID', 'RATE'],
			'order' => ['ID' => 'ASC']
		]);
		while ($row = $iterator->fetch())
			$this->storage['VATS'][(int)$row['ID']] = (float)$row['RATE'];
		unset($row, $iterator);

		if (!empty($this->storage['CATALOGS']))
		{
			foreach ($this->storage['CATALOGS'] as $catalog)
			{
				$this->storage['IBLOCKS_VAT'][$catalog['IBLOCK_ID']] = 0;
				if ($catalog['PRODUCT_IBLOCK_ID'] > 0)
					$this->storage['IBLOCKS_VAT'][$catalog['PRODUCT_IBLOCK_ID']] = 0;
			}
			unset($catalog);

			$iterator = CatalogCatalogIblockTable::getList([
				'select' => ['IBLOCK_ID', 'VAT_ID'],
				'filter' => ['@IBLOCK_ID' => array_keys($this->storage['IBLOCKS_VAT'])]
			]);
			while ($row = $iterator->fetch())
				$this->storage['IBLOCKS_VAT'][(int)$row['IBLOCK_ID']] = (int)$row['VAT_ID'];
			unset($row, $iterator);
		}
	}
}