- Модуль: sale
- Путь к файлу: ~/bitrix/modules/sale/lib/location/import/compiler/compiler.php
- Класс: BitrixSaleLocationImportCompilerCompiler
- Вызов: Compiler::generateExportTreeWorld
private function generateExportTreeWorld()
{
$this->eTreeDB->dropCodeIndex();
$this->eTreeDB->restoreExportOffset();
$this->eTreeDB->switchIndexes(false);
$csv = new ImportCSVReader();
$csv->loadFile($_SERVER['DOCUMENT_ROOT'].'/locations_data/'.self::WORLD_SOURCE);
$countries = array();
while($item = $csv->Fetch())
{
$item = explode(',', $item[0]);
if(!isset($item[1])) // its a language marker
continue;
// exclude the following countries, kz we got an extended file for them
if(in_array($item[2], array('USA', 'Kazakhstan', 'Ukraine', 'Byelorussia', 'Russian Federation', 'Azerbaijan', 'Estonia', 'Georgia', 'Latvia', 'Lithuania', 'Moldavia', 'Turkmenistan', 'Armenia', 'Tadjikistan', 'Uzbekistan')))
continue;
$id = implode(':', $item);
$countries[] = $item[2].' - '.$item[4];
$this->eTreeDB->insert(array(
'TYPE_CODE' => 'COUNTRY',
'NAME' => $item[4],
'LANGNAMES' => serialize(array(
'RU' => array('NAME' => $item[4]),
'EN' => array('NAME' => $item[2])
)),
'EXTERNALS' => '',
'SOURCE' => self::SOURCE_LEGACY,
'SYS_CODE' => $this->mapETCodeAsLegacy($id),
'PARENT_SYS_CODE' => ''
));
}
$this->eTreeDB->doneInsert();
$this->eTreeDB->switchIndexes(true);
}