• Модуль: sale
  • Путь к файлу: ~/bitrix/modules/sale/lib/location/import/compiler/compiler.php
  • Класс: BitrixSaleLocationImportCompilerCompiler
  • Вызов: Compiler::putToGroups
private function putToGroups($item)
{
	foreach($this->typeGroups as $gCode => &$group)
	{
		//_dump_r('Item '.$item['NAME.RU.NAME'].' ('.$item['TYPE_CODE'].')');

		if(!isset($group['I_TYPES'][$item['TYPE_CODE']]))
			continue;

		//_dump_r('Goes to group: '.$gCode);

		$baseParent = $this->getParentOfType($item['CODE'], $this->typeGroups[$group['PARENT']]['I_TYPES']);

		//_dump_r('Base parent is: '.$baseParent);

		if(!$group['FD'][$baseParent])
		{
			$fName = str_replace(array(
				'%BASE_PARENT_ITEM_CODE%',
				'%CODE%'
			), array(
				$baseParent,
				ToLower($gCode)
			), $group['FILE_NAME_TEMPLATE']);

			$group['FD'][$baseParent] = $this->fileOpen($fName);
			fputs($group['FD'][$baseParent], implode(';', $this->headers[$group['HEADER']]).PHP_EOL);
		}

		$header = $this->headers[$group['HEADER']];
		$line = array();
		foreach($header as $code)
			$line[] = isset($item[$code]) ? $item[$code] : '';

		fputs($group['FD'][$baseParent], implode(';', $line).PHP_EOL);
	}
}