15$maxDepthLevel = (int)COption::GetOptionInt(
"catalog",
"num_catalog_levels", 3);
32 if (isset($arOldSetupVars[
'IBLOCK_ID']))
63 if (isset($arOldSetupVars[
'IBLOCK_ID']) && $arOldSetupVars[
'IBLOCK_ID'] ==
$IBLOCK_ID)
65 if (isset($arOldSetupVars[
'field_needed']))
66 $field_needed = $arOldSetupVars[
'field_needed'];
67 if (isset($arOldSetupVars[
'field_num']))
68 $field_num = $arOldSetupVars[
'field_num'];
69 if (isset($arOldSetupVars[
'field_code']))
70 $field_code = $arOldSetupVars[
'field_code'];
72 if (isset($arOldSetupVars[
'fields_type']))
73 $fields_type = $arOldSetupVars[
'fields_type'];
75 if (isset($arOldSetupVars[
'delimiter_r']))
76 $delimiter_r = $arOldSetupVars[
'delimiter_r'];
77 if (isset($arOldSetupVars[
'delimiter_r_char']))
78 $delimiter_r_char = $arOldSetupVars[
'delimiter_r_char'];
79 if (isset($arOldSetupVars[
'delimiter_other_r']))
80 $delimiter_other_r = $arOldSetupVars[
'delimiter_other_r'];
82 if (isset($arOldSetupVars[
'SETUP_FILE_NAME']))
84 if (isset($arOldSetupVars[
'SETUP_PROFILE_NAME']))
85 $SETUP_PROFILE_NAME = $arOldSetupVars[
'SETUP_PROFILE_NAME'];
86 if (isset($arOldSetupVars[
'first_line_names']))
87 $first_line_names = $arOldSetupVars[
'first_line_names'];
88 if (isset($arOldSetupVars[
'export_files']))
89 $export_files = $arOldSetupVars[
'export_files'];
90 if (isset($arOldSetupVars[
'export_from_clouds']))
91 $export_from_clouds = $arOldSetupVars[
'export_from_clouds'];
92 if (isset($arOldSetupVars[
'CML2_LINK_IS_XML']))
94 if (isset($arOldSetupVars[
'MAX_EXECUTION_TIME']))
100 if (!isset($fields_type) || ($fields_type!=
"F" && $fields_type!=
"R"))
105 $delimiter_r_char =
"";
106 if (isset($delimiter_r))
108 switch ($delimiter_r)
111 $delimiter_r_char =
"\t";
114 $delimiter_r_char =
",";
117 $delimiter_r_char =
" ";
120 $delimiter_r_char = (isset($delimiter_other_r)? mb_substr($delimiter_other_r, 0, 1) :
'');
121 $delimiter_other_r = $delimiter_r_char;
124 $delimiter_r_char =
";";
129 if (mb_strlen($delimiter_r_char) != 1)
183 $bFieldsPres = (!empty($field_needed) && is_array($field_needed) && in_array(
'Y', $field_needed));
184 if ($bFieldsPres && (empty($field_code) || !is_array($field_code)))
186 $bFieldsPres =
false;
195 if (isset($_POST[
'MAX_EXECUTION_TIME']) && is_string($_POST[
'MAX_EXECUTION_TIME']))
201 if ((
$ACTION==
"EXPORT_SETUP" ||
$ACTION ==
'EXPORT_EDIT' ||
$ACTION ==
'EXPORT_COPY') && (!isset($SETUP_PROFILE_NAME) || $SETUP_PROFILE_NAME ==
''))
216 "TEXT" =>
GetMessage(
"CATI_ADM_RETURN_TO_LIST"),
217 "TITLE" =>
GetMessage(
"CATI_ADM_RETURN_TO_LIST_TITLE"),
218 "LINK" =>
"/bitrix/admin/cat_export_setup.php?lang=".LANGUAGE_ID,
219 "ICON" =>
"btn_list",
236<form method=
"POST" action=
"<? echo $APPLICATION->GetCurPage().$actionParams; ?>" enctype=
"multipart/form-data" name=
"dataload">
239 array(
"DIV" =>
"edit1",
"TAB" =>
GetMessage(
"CAT_ADM_CSV_EXP_TAB1"),
"ICON" =>
"store",
"TITLE" =>
GetMessage(
"CAT_ADM_CSV_EXP_TAB1_TITLE")),
240 array(
"DIV" =>
"edit2",
"TAB" =>
GetMessage(
"CAT_ADM_CSV_EXP_TAB2"),
"ICON" =>
"store",
"TITLE" =>
GetMessage(
"CAT_ADM_CSV_EXP_TAB2_TITLE")),
241 array(
"DIV" =>
"edit3",
"TAB" =>
GetMessage(
"CAT_ADM_CSV_EXP_TAB3"),
"ICON" =>
"store",
"TITLE" =>
GetMessage(
"CAT_ADM_CSV_EXP_TAB3_TITLE")),
251 ?><tr
class=
"heading">
252 <td colspan=
"2"><?echo
GetMessage(
"CATI_DATA_EXPORT") ?></td>
255 <td valign=
"top" width=
"40%"><? echo
GetMessage(
"CAT_ADM_CSV_EXP_IBLOCK_ID"); ?>:</td>
256 <td valign=
"top" width=
"60%"><?
263 array(
'CHECK_PERMISSIONS' =>
'Y',
'MIN_PERMISSION' =>
'U'),
266 'class="adm-detail-iblock-types"',
267 'class="adm-detail-iblock-list"'
279 ?><tr
class=
"heading">
280 <td colspan=
"2"><?echo
GetMessage(
"CATI_FORMAT_PROPS") ?></td>
283 <td valign=
"top" width=
"40%"><?echo
GetMessage(
"CATI_DELIMITERS") ?>:</td>
284 <td valign=
"top" width=
"60%"><?
285 if (!isset($delimiter_r) || empty($delimiter_r))
286 $delimiter_r =
'TZP';
287 ?><input type=
"hidden" name=
"fields_type" value=
"R">
288 <input type=
"radio" name=
"delimiter_r" value=
"TZP" <?
if ($delimiter_r==
"TZP") echo
"checked"?>><?echo
GetMessage(
"CATI_TZP") ?><br>
289 <input type=
"radio" name=
"delimiter_r" value=
"ZPT" <?
if ($delimiter_r==
"ZPT") echo
"checked"?>><?echo
GetMessage(
"CATI_ZPT") ?><br>
290 <input type=
"radio" name=
"delimiter_r" value=
"TAB" <?
if ($delimiter_r==
"TAB") echo
"checked"?>><?echo
GetMessage(
"CATI_TAB") ?><br>
291 <input type=
"radio" name=
"delimiter_r" value=
"SPS" <?
if ($delimiter_r==
"SPS") echo
"checked"?>><?echo
GetMessage(
"CATI_SPS") ?><br>
292 <input type=
"radio" name=
"delimiter_r" value=
"OTR" <?
if ($delimiter_r==
"OTR") echo
"checked"?>><?echo
GetMessage(
"CATI_OTR") ?>
293 <input type=
"text" class=
"typeinput" name=
"delimiter_other_r" size=
"3" value=
"<?echo htmlspecialcharsbx($delimiter_other_r); ?>">
297 <td valign=
"top" width=
"40%"><label
for=
"first_line_names_Y"><?echo
GetMessage(
"CATI_FIRST_LINE_NAMES") ?>:</label></td>
298 <td valign=
"top" width=
"60%"><?
299 if (!isset($first_line_names))
300 $first_line_names =
'Y';
301 ?><input type=
"hidden" name=
"first_line_names" id=
"first_line_names_N" value=
"N">
302 <input type=
"checkbox" name=
"first_line_names" id=
"first_line_names_Y" value=
"Y" <?
if ($first_line_names==
"Y") echo
"checked"?>>
306 <td colspan=
"2"><?echo
GetMessage(
"CATI_FIELDS") ?></td>
310 <table
width=
"100%" border=
"0" cellspacing=
"0" cellpadding=
"0" class=
"internal">
319 array(
'IBLOCK_ID',
'PRODUCT_IBLOCK_ID',
'SKU_PROPERTY_ID')
327 $allowedProductFields =
array();
328 $allowedSectionFields =
array();
330 $allowedPriceFields =
array();
332 $fieldsOption = trim(COption::GetOptionString(
'catalog',
'allowed_product_fields'));
333 if ($fieldsOption !=
'')
335 $allowedProductFields = explode(
',', $fieldsOption);
337 $fieldsOption = trim(COption::GetOptionString(
'catalog',
'allowed_group_fields'));
338 if ($fieldsOption !=
'')
340 $allowedSectionFields = explode(
',', $fieldsOption);
344 $fieldsOption = trim(COption::GetOptionString(
'catalog',
'allowed_price_fields'));
345 if ($fieldsOption !=
'')
347 $allowedPriceFields = explode(
',', $fieldsOption);
351 $arAvailFields =
array();
355 if (!empty($allowedProductFields))
358 foreach ($allowedProductFields as &$fieldName)
360 if (isset($elementFields[$fieldName]))
362 $arAvailFields[$intCount] = $elementFields[$fieldName];
363 $arAvailFields[$intCount][
'sort'] = ($intCount+1)*10;
366 $arAvailFields[$intCount][
'SEP'] =
GetMessage(
'CAT_ADM_CSV_EXP_SEP_ELEMENTS');
372 unset($fieldName, $elementFields);
376 while ($prop_fields = $properties->Fetch())
378 $prop_fields[
'CODE'] = (string)$prop_fields[
'CODE'];
379 if ($prop_fields[
'CODE'] ===
'')
380 $prop_fields[
'CODE'] = $prop_fields[
'ID'];
381 $arAvailFields[$intCount] =
array(
382 "value" =>
"IP_PROP".$prop_fields[
"ID"],
383 "name" =>
GetMessage(
"CATI_FI_PROPS").
' "'.$prop_fields[
"NAME"].
'"'.
' ['.$prop_fields[
'CODE'].
']',
384 'sort' => ($intCount+1)*10,
388 $arAvailFields[$intCount][
'SEP'] =
GetMessage(
'CAT_ADM_CSV_EXP_SEP_ELEMENTS');
393 if (isset($prop_fields))
398 if (!empty($allowedSectionFields))
401 $selectedSectionFields =
array();
402 foreach ($allowedSectionFields as &$fieldName)
410 if (!empty($selectedSectionFields))
412 for ($currentDepthLevel = 0; $currentDepthLevel <
$maxDepthLevel; $currentDepthLevel++)
415 foreach ($selectedSectionFields as &$oneField)
417 $arAvailFields[$intCount] = $oneField;
418 $arAvailFields[$intCount][
'value'] .= $currentDepthLevel;
419 $arAvailFields[$intCount][
'sort'] = ($intCount+1)*10;
422 $arAvailFields[$intCount][
'SEP'] =
GetMessage(
'CAT_ADM_CSV_EXP_SEP_SECTIONS');
427 $arAvailFields[$intCount][
'SUB_SEP'] = str_replace(
'#LEVEL#',($currentDepthLevel+1),
GetMessage(
"CAT_ADM_CSV_EXP_SECTION_LEVEL"));
435 unset($selectedSectionFields);
440 if (!empty($allowedProductFields))
444 foreach ($allowedProductFields as &$fieldName)
449 $arAvailFields[$intCount][
'sort'] = ($intCount+1)*10;
452 $arAvailFields[$intCount][
'SEP'] =
GetMessage(
'CAT_ADM_CSV_EXP_SEP_PRODUCT');
461 if (!empty($allowedPriceFields))
465 foreach ($allowedPriceQuantityFields as &$fieldName)
467 if (isset($priceQuantityFields[$fieldName]))
469 $arAvailFields[$intCount] = $priceQuantityFields[$fieldName];
470 $arAvailFields[$intCount][
'sort'] = ($intCount+1)*10;
473 $arAvailFields[$intCount][
'SEP'] =
GetMessage(
'CAT_ADM_CSV_EXP_SEP_PRICES');
479 unset($fieldName, $priceQuantityFields);
483 array(
'SORT' =>
'ASC',
'ID' =>
'ASC'),
487 array(
'ID',
'NAME',
'NAME_LANG')
489 while ($priceType = $rsPriceTypes->Fetch())
491 $priceType[
'NAME_LANG'] = (string)$priceType[
'NAME_LANG'];
492 foreach ($allowedPriceFields as &$fieldName)
496 $priceName = ($priceType[
'NAME_LANG'] !==
'' ?
497 str_replace(
array(
'#TYPE#',
'#NAME#'),
array($priceType[
'NAME'], $priceType[
'NAME_LANG']),
GetMessage(
'EST_PRICE_TYPE2')):
498 str_replace(
"#TYPE#", $priceType[
'NAME'],
GetMessage(
'EST_PRICE_TYPE'))
501 $arAvailFields[$intCount][
'value'] .=
'_'.$priceType[
'ID'];
502 $arAvailFields[$intCount][
'name'] = $priceName.
': '.$arAvailFields[$intCount][
'name'];
503 $arAvailFields[$intCount][
'sort'] = ($intCount+1)*10;
506 $arAvailFields[$intCount][
'SEP'] =
GetMessage(
'CAT_ADM_CSV_EXP_SEP_PRICES');
518 $intCountAvailFields = $intCount;
519 $intCountChecked = 0;
520 $arCheckID =
array();
522 if (isset($field_code) && !empty($field_code) && is_array($field_code))
524 foreach ($arAvailFields as
$i => $arOneAvailField)
527 $key = array_search($arOneAvailField[
'value'], $field_code);
530 if (isset($field_needed[
$key]) &&
'Y' == $field_needed[
$key])
533 $arCheckID[] = $arOneAvailField[
'value'];
536 if (isset($field_num[
$key]) && 0 < intval($field_num[
$key]))
537 $intSort = intval($field_num[
$key]);
540 $arAvailFields[
$i][
'sort'] = $intSort;
544 $intCountChecked = $intCountAvailFields;
545 ?><tr
class=
"heading">
546 <td valign=
"middle" align=
"left" style=
"text-align: left;">
547 <input
style=
"vertical-align: middle;" type=
"checkbox" name=
"field_needed_all" id=
"field_needed_all" value=
"Y" onclick=
"checkAll(this,<? echo $intCountAvailFields; ?>);"<? echo ($boolAll || ($intCountChecked == $intCountAvailFields) ?
' checked' :
''); ?>>&
nbsp;
548 <b><?echo
GetMessage(
"CATI_FIELDS_NEEDED") ?></b></td>
549 <td valign=
"middle" align=
"center"><b><?echo
GetMessage(
"CATI_FIELDS_NAMES") ?></b></td>
550 <td valign=
"middle" align=
"center"><b><?echo
GetMessage(
"CATI_FIELDS_SORTING") ?></b></td>
552 foreach ($arAvailFields as
$i => $arOneAvailField)
554 if (!empty($arOneAvailField[
'SEP']))
556 ?><tr><td colspan=
"3" valign=
"middle" align=
"center"><b><? echo
htmlspecialcharsbx($arOneAvailField[
'SEP']); ?></b></td></tr><?
558 if (!empty($arOneAvailField[
'SUB_SEP']))
564 <td valign=
"top" align=
"left"><input type=
"checkbox" name=
"field_needed[<? echo $i; ?>]" id=
"field_needed_<? echo $i; ?>"
565 <?
if ($boolAll || in_array($arOneAvailField[
'value'],$arCheckID)) echo
"checked"; ?>
566 value=
"Y" onclick=
"checkOne(this,<? echo $intCountAvailFields; ?>);"></td>
567 <td valign=
"middle" align=
"left">
568 <?
if (
$i<2) echo
"<b>";?>
570 <?
if (
$i<2) echo
"</b>";?>
572 <td valign=
"top" align=
"center">
573 <?
if (
$i<2) echo
"<b>";?>
574 <input type=
"text" class=
"typeinput" name=
"field_num[<?echo $i ?>]" value=
"<?echo $arOneAvailField['sort']; ?>" size=
"4"> <input type=
"hidden" name=
"field_code[<?echo $i ?>]"
575 value=
"<?echo htmlspecialcharsbx($arOneAvailField["value
"]) ?>">
576 <?
if (
$i<2) echo
"</b>";?>
583 <input type=
"hidden" name=
"count_checked" id=
"count_checked" value=
"<? echo $intCountChecked; ?>">
585 function checkAll(obj,cnt)
587 var boolCheck = obj.checked,
589 for (i = 0; i < cnt; i++)
591 BX(
'field_needed_'+i).checked = boolCheck;
593 BX(
'count_checked').value = (boolCheck ? cnt : 0);
595 function checkOne(obj,cnt)
597 var boolCheck = obj.checked;
598 var intCurrent = parseInt(BX(
'count_checked').value);
599 intCurrent += (boolCheck ? 1 : -1);
600 BX(
'field_needed_all').checked = (intCurrent >= cnt);
601 BX(
'count_checked').value = intCurrent;
607 <td colspan=
"2"><? echo
GetMessage(
'CAT_ADM_CSV_EXP_ADD_SETTINGS') ?></td>
615 <td
width=
"40%"><? echo
GetMessage(
'CAT_ADM_CSV_EXP_CML2_LINK_IS_XML'); ?>:</td>
617 <input type=
"hidden" name=
"CML2_LINK_IS_XML" value=
"N">
618 <input type=
"checkbox" name=
"CML2_LINK_IS_XML" value=
"Y" <? echo (
$CML2_LINK_IS_XML ==
'Y' ?
'checked' :
''); ?>>
624 <td valign=
"top" width=
"40%"><label
for=
"export_files"><? echo
GetMessage(
'CAT_ADM_CSV_EXP_EXPORT_FILES'); ?>:</label></td>
625 <td valign=
"top" width=
"60%">
626 <input type=
"hidden" name=
"export_files" id=
"export_files_N" value=
"N">
627 <input type=
"checkbox" name=
"export_files" id=
"export_files_Y" value=
"Y" <? echo (isset($export_files) && $export_files ==
'Y' ?
'checked' :
''); ?>>
630 $boolHaveClouds =
false;
635 <td valign=
"top" width=
"40%"><label
for=
"export_from_clouds"><? echo
GetMessage(
'CAT_ADM_CSV_EXP_EXPORT_FROM_CLOUDS'); ?>:</label></td>
636 <td valign=
"top" width=
"60%">
637 <input type=
"hidden" name=
"export_from_clouds" id=
"export_from_clouds_N" value=
"N">
638 <input type=
"checkbox" name=
"export_from_clouds" id=
"export_from_clouds_Y" value=
"Y" <? echo (isset($export_from_clouds) && $export_from_clouds ==
'Y' ?
'checked' :
''); ?>>
644 ?><input type=
"hidden" name=
"export_from_clouds" id=
"export_from_clouds_N" value=
"N"><?
651 <input type=
"text" name=
"MAX_EXECUTION_TIME" size=
"40" value=
"<?=$maxExecutionTime; ?>">
656 <td
width=
"60%" style=
"padding-top: 0;"><small><?=
GetMessage(
"CAT_MAX_EXECUTION_TIME_NOTE");?></small></td>
659 <td colspan=
"2"><?echo
GetMessage(
"CATI_DATA_FILE_NAME") ?></td>
662 <td valign=
"top" width=
"40%"><?echo
GetMessage(
"CATI_DATA_FILE_NAME1") ?>:</td>
664 <input type=
"text" class=
"typeinput" name=
"SETUP_FILE_NAME" size=
"40" value=
"<?echo htmlspecialcharsbx($SETUP_FILE_NAME <> '' ? str_replace($strCatalogDefaultFolder, '', $SETUP_FILE_NAME): "export_file_
".mt_rand(0, 999999).".csv
");?>"><br>
665 <small><?echo
GetMessage(
"CATI_DATA_FILE_NAME1_DESC") ?></small>
671 ?><tr
class=
"heading">
672 <td colspan=
"2"><?echo
GetMessage(
"CATI_SAVE_SCHEME") ?></td>
675 <td valign=
"top" width=
"40%"><?echo
GetMessage(
"CATI_SSCHEME_NAME") ?>:</td>
676 <td valign=
"top" width=
"60%"><input type=
"text" class=
"typeinput" name=
"SETUP_PROFILE_NAME" size=
"40"
677 value=
"<?echo htmlspecialcharsbx($SETUP_PROFILE_NAME)?>"></td>
698 ?><input type=
"hidden" name=
"PROFILE_ID" value=
"<? echo intval($PROFILE_ID); ?>"><?
703 ?><input type=
"hidden" name=
"STEP" value=
"<? echo $STEP+1; ?>">
704 <input type=
"hidden" name=
"lang" value=
"<? echo LANGUAGE_ID; ?>">
705 <input type=
"hidden" name=
"ACT_FILE" value=
"<? echo htmlspecialcharsbx($_REQUEST["ACT_FILE
"]); ?>">
706 <input type=
"hidden" name=
"ACTION" value=
"<? echo htmlspecialcharsbx($ACTION); ?>">
709 ?><input type=
"hidden" name=
"IBLOCK_ID" value=
"<? echo $IBLOCK_ID; ?>">
710 <input type=
"hidden" name=
"SETUP_FIELDS_LIST" value=
"IBLOCK_ID,SETUP_FILE_NAME,fields_type,delimiter_r,delimiter_other_r,first_line_names,field_needed,field_num,field_code,export_files,export_from_clouds,CML2_LINK_IS_XML,MAX_EXECUTION_TIME"><?
714 ?><input type=
"submit" class=
"button" name=
"backButton" value=
"<< <?echo GetMessage("CATI_BACK
") ?>"><?
716 ?><input type=
"submit" class=
"button" value=
"<?echo ($STEP == 2)?(($ACTION == "EXPORT
")?GetMessage("CATI_NEXT_STEP_F
"):GetMessage("CET_SAVE
")):GetMessage("CATI_NEXT_STEP
")." &
gt;&
gt;
" ?>" name=
"submit_btn"><?
724tabControl.SelectTab(
"edit1");
725tabControl.DisableTab(
"edit2");
726tabControl.DisableTab(
"edit3");
728tabControl.SelectTab(
"edit2");
729tabControl.DisableTab(
"edit1");
730tabControl.DisableTab(
"edit3");
732tabControl.SelectTab(
"edit3");
733tabControl.DisableTab(
"edit1");
734tabControl.DisableTab(
"edit2");
const BX_CATALOG_FILENAME_REG
const CATALOG_DEFAULT_EXPORT_PATH
if($strVal !='') $sectionFields
if($strVal !='') $priceFields
if($strVal !='') $productFields
static GetList($arOrder=Array(), $arFilter=Array())
static getDefaultSettings($type, $extFormat=false)
static getSettingsFields($type, $extFormat=false)
static GetListEx($arOrder=array(), $arFilter=array(), $arGroupBy=false, $arNavStartParams=false, $arSelectFields=array())
static GetList($arOrder=array(), $arFilter=array(), $arGroupBy=false, $arNavStartParams=false, $arSelectFields=array())
static GetList($arOrder=Array("SORT"=>"ASC"), $arFilter=Array(), $bIncCnt=false)
bx popup label bx width30 PAGE_NEW_MENU_NAME text width
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
GetIBlockDropDownListEx($IBLOCK_ID, $strTypeName, $strIBlockName, $arFilter=false, $onChangeType='', $onChangeIBlock='', $strAddType='', $strAddIBlock='')
global $adminSidePanelHelper
$_SERVER["DOCUMENT_ROOT"]
if(!($arIBlock=$arIBlockres->Fetch())) $boolCatalog
if(empty($arRunErrors)) $CML2_LINK_IS_XML
if(!CCatalog::IsUserExists()) if(!function_exists( '__CSVArrayMultiply')) if(!function_exists('__CSVExportFile')) $strCatalogDefaultFolder
if(( $ACTION=='EXPORT_EDIT'||$ACTION=='EXPORT_COPY') &&$STEP==1) if($STEP > 1) if(( $ACTION=='EXPORT_EDIT'||$ACTION=='EXPORT_COPY') &&$STEP==2) if($STEP >2) $aMenu
bitrix_sessid_post($varname='sessid', $returnInvocations=false)
HasScriptExtension($check_name)
ShowError($strError, $cls="errortext")
htmlspecialcharsbx($string, $flags=ENT_COMPAT, $doubleEncode=true)
IncludeModuleLangFile($filepath, $lang=false, $bReturnArray=false)
GetMessage($name, $aReplace=null)
if( $daysToExpire >=0 &&$daysToExpire< 60 elseif)( $daysToExpire< 0)
if(empty($signedUserToken)) $key