- Модуль: sale
- Путь к файлу: ~/bitrix/modules/sale/lib/location/import/compiler/compiler.php
- Класс: BitrixSaleLocationImportCompileris
- Вызов: is::generateExportTreePutRussiaBundle
private function generateExportTreePutRussiaBundle($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
$fNode = $this->fiasDB->getByAOGUID($regions[$node['ID']]['AOGUID']);
if(strlen($fNode['POSTALCODE']))
$node['EXT']['ZIP'][] = $fNode['POSTALCODE'];
$edges = array(); // no way farther
}
// set english name for Russia
if($node['TYPE_CODE'] == 'COUNTRY')
$node['NAME']['EN']['NAME'] = 'Russian Federation';
if($node['NAME']['RU']['NAME'] == 'Москва и Московская область')
$node['NAME']['RU']['NAME'] = 'Московская область';
if($node['NAME']['RU']['NAME'] == 'Санкт-Петербург и Ленинградская область')
$node['NAME']['RU']['NAME'] = 'Ленинградская область';
$this->eTreeDBRussia->insert(array(
'TYPE_CODE' => $node['TYPE_CODE'],
'NAME' => $node['NAME']['RU']['NAME'],
'LANGNAMES' => $node['NAME'],
'EXTERNALS' => $node['EXT'],
'SOURCE' => self::SOURCE_YANDEX,
'SYS_CODE' => $this->mapETCodeAsYandex($node['ID']),
'PARENT_SYS_CODE' => strlen($node['PARENT_ID']) && $dl > 0 ? $this->mapETCodeAsYandex($node['PARENT_ID']) : ''
));
if(!empty($edges))
$this->generateExportTreePutRussiaBundle($edges, $regions, $dl+1);
}
}
}