- Модуль: sale
- Путь к файлу: ~/bitrix/modules/sale/lib/location/import/compiler/compiler.php
- Класс: BitrixSaleLocationImportCompilerCompiler
- Вызов: Compiler::addItemToExportTree
private function addItemToExportTree($item)
{
$this->exportOffset++;
$this->output('ADD: '.$item['NAME']['RU']['NAME'].' '.$item['TYPE']);
//$this->output($item);
$cat = $this->sysMaps['BASETYPE2GROUP'][$item['TYPE']];
$fName = $this->typeGroups[$cat]['FILE_NAME_TEMPLATE'];
$header = $this->typeGroups[$cat];
$this->alreadyDumped[$item['ID']] = $this->exportOffset;
$parentCode = strlen($item['PARENT_ID']) ? $this->addLeadingZero($this->alreadyDumped[$item['PARENT_ID']], self::CODE_LENGTH) : '';
$data = array(
'CODE' => $this->addLeadingZero($this->exportOffset, self::CODE_LENGTH),
'PARENT_CODE' => $parentCode,
'TYPE_CODE' => $item['TYPE']
);
foreach($item['NAME'] as $lid => $values)
{
foreach($values as $i => $val)
$data['NAME.'.$lid.'.'.$i] = $val;
}
$data['EXT.YAMARKET.0'] = '';
$data['EXT.ZIP.0'] = '';
if(!empty($item['EXTERNALS']))
{
foreach($item['EXTERNALS'] as $type => $values)
{
foreach($values as $i => $val)
$data['EXT.'.$type.'.'.$i] = $val;
}
}
$parentGroupId = strlen($item['PARENT_GROUP_ID']) ? $this->addLeadingZero($this->alreadyDumped[$item['PARENT_GROUP_ID']], self::CODE_LENGTH) : '';
$data['LONGITUDE'] = '';
$data['LATITUDE'] = '';
//$this->output('PGID is set to '.$parentGroupId);
$fName = str_replace(array(
'%BASE_PARENT_ITEM_CODE%',
'%CODE%',
'.csv'
), array(
$parentGroupId,
ToLower($cat),
''
), $fName);
$this->output('PUT:');
$this->output($data);
$this->output('TO:');
$this->output($fName);
$this->putToFile2(
$data,
'assets',
$fName,
true
);
}