• Модуль: sale
  • Путь к файлу: ~/bitrix/modules/sale/lib/location/import/compiler/compiler.php
  • Класс: BitrixSaleLocationImportCompilerCompiler
  • Вызов: Compiler::generateExportTreePutRussiaBundleOld
private function generateExportTreePutRussiaBundleOld($bundle, $regions, $dl = 0)
{
	foreach($bundle as $id)
	{
		$node = $this->data['TREES']['MAIN']['NODES'][$id];

		$edges = array();
		if(isset($this->data['TREES']['MAIN']['EDGES'][$id]))
			$edges = $this->data['TREES']['MAIN']['EDGES'][$id];
		
		if(in_array($node['TYPE_CODE'], array('COUNTRY', 'COUNTRY_DISTRICT', 'REGION')))
		{
			if($node['TYPE_CODE'] == 'REGION')
			{
				// get fias code & postal code, if any
				//$node['EXT']['FIAS'][] = $regions[$node['ID']]['AOGUID'];

				$fNode = $this->fiasGetByAOGUID($regions[$node['ID']]['AOGUID']);
				if(strlen($fNode['POSTALCODE']))
					$node['EXT']['ZIP'][] = $fNode['POSTALCODE'];

				$edges = array(); // no way farther
			}

			$this->addItemToExportTree(array(
				'ID' => 			$this->mapETCodeAsYandex($node['ID']),
				'PARENT_ID' => 		strlen($node['PARENT_ID']) && $dl > 0 ? $this->mapETCodeAsYandex($node['PARENT_ID']) : '',
				'TYPE' => 			$node['TYPE_CODE'],
				'NAME' => 			$node['NAME'],
				'EXTERNALS' =>		$node['EXT'],
				'SOURCE' => 		self::SOURCE_YANDEX,
			));

			if(!empty($edges))
				$this->generateExportTreePutRussiaBundle($edges, $regions, $dl+1);
		}
	}
}