CSV (new) /** @global CDatabase $DB */ /** @global CUser $USER */ /** @global CMain $APPLICATION */ /** @global string $ACTION */ /** @global array $arOldSetupVars */ /** @global int $IBLOCK_ID */ IncludeModuleLangFile($_SERVER['DOCUMENT_ROOT'].'/bitrix/modules/catalog/export_setup_templ.php'); IncludeModuleLangFile($_SERVER['DOCUMENT_ROOT'].'/bitrix/modules/catalog/export_yandex.php'); IncludeModuleLangFile(__FILE__); global $APPLICATION, $USER; $maxDepthLevel = (int)COption::GetOptionInt("catalog", "num_catalog_levels", 3); if ($maxDepthLevel <= 0) $maxDepthLevel = 3; $arSetupErrors = array(); $strCatalogDefaultFolder = COption::GetOptionString("catalog", "export_default_path", CATALOG_DEFAULT_EXPORT_PATH); $STEP = (int)$STEP; if (0 >= $STEP) $STEP = 1; $ACTION = strval($ACTION); //******************** ACTIONS **************************************// if (($ACTION == 'EXPORT_EDIT' || $ACTION == 'EXPORT_COPY') && $STEP == 1) { if (isset($arOldSetupVars['IBLOCK_ID'])) $IBLOCK_ID = $arOldSetupVars['IBLOCK_ID']; } if ($STEP > 1) { $IBLOCK_ID = (int)$IBLOCK_ID; if ($IBLOCK_ID <= 0) { $arSetupErrors[] = GetMessage("CATI_NO_IBLOCK"); } else { $rsIBlocks = CIBlock::GetList(array(),array('IBLOCK_ID' => $IBLOCK_ID,'CHECK_PERMISSIONS' => 'N')); if (!($arIBlock = $rsIBlocks->Fetch())) { $arSetupErrors[] = GetMessage("CATI_NO_IBLOCK"); } elseif (!CIBlockRights::UserHasRightTo($IBLOCK_ID, $IBLOCK_ID, 'iblock_admin_display')) { $arSetupErrors[] = str_replace('#IBLOCK_ID#', $IBLOCK_ID, GetMessage('CET_ERROR_IBLOCK_PERM')); } } if (!empty($arSetupErrors)) { $STEP = 1; } } if (($ACTION == 'EXPORT_EDIT' || $ACTION == 'EXPORT_COPY') && $STEP == 2) { if (isset($arOldSetupVars['IBLOCK_ID']) && $arOldSetupVars['IBLOCK_ID'] == $IBLOCK_ID) { if (isset($arOldSetupVars['field_needed'])) $field_needed = $arOldSetupVars['field_needed']; if (isset($arOldSetupVars['field_num'])) $field_num = $arOldSetupVars['field_num']; if (isset($arOldSetupVars['field_code'])) $field_code = $arOldSetupVars['field_code']; } if (isset($arOldSetupVars['fields_type'])) $fields_type = $arOldSetupVars['fields_type']; if (isset($arOldSetupVars['delimiter_r'])) $delimiter_r = $arOldSetupVars['delimiter_r']; if (isset($arOldSetupVars['delimiter_r_char'])) $delimiter_r_char = $arOldSetupVars['delimiter_r_char']; if (isset($arOldSetupVars['delimiter_other_r'])) $delimiter_other_r = $arOldSetupVars['delimiter_other_r']; if (isset($arOldSetupVars['SETUP_FILE_NAME'])) $SETUP_FILE_NAME = str_replace($strCatalogDefaultFolder, '', $arOldSetupVars['SETUP_FILE_NAME']); if (isset($arOldSetupVars['SETUP_PROFILE_NAME'])) $SETUP_PROFILE_NAME = $arOldSetupVars['SETUP_PROFILE_NAME']; if (isset($arOldSetupVars['first_line_names'])) $first_line_names = $arOldSetupVars['first_line_names']; if (isset($arOldSetupVars['export_files'])) $export_files = $arOldSetupVars['export_files']; if (isset($arOldSetupVars['export_from_clouds'])) $export_from_clouds = $arOldSetupVars['export_from_clouds']; if (isset($arOldSetupVars['CML2_LINK_IS_XML'])) $CML2_LINK_IS_XML = $arOldSetupVars['CML2_LINK_IS_XML']; if (isset($arOldSetupVars['MAX_EXECUTION_TIME'])) $maxExecutionTime = $arOldSetupVars['MAX_EXECUTION_TIME']; } if ($STEP>2) { if (!isset($fields_type) || ($fields_type!="F" && $fields_type!="R")) { $arSetupErrors[] = GetMessage("CATI_NO_FORMAT"); } $delimiter_r_char = ""; if (isset($delimiter_r)) { switch ($delimiter_r) { case "TAB": $delimiter_r_char = "\t"; break; case "ZPT": $delimiter_r_char = ","; break; case "SPS": $delimiter_r_char = " "; break; case "OTR": $delimiter_r_char = (isset($delimiter_other_r)? mb_substr($delimiter_other_r, 0, 1) : ''); $delimiter_other_r = $delimiter_r_char; break; case "TZP": $delimiter_r_char = ";"; break; } } if (mb_strlen($delimiter_r_char) != 1) { $arSetupErrors[] = GetMessage("CATI_NO_DELIMITER"); } if (!isset($SETUP_FILE_NAME) || $SETUP_FILE_NAME == '') { $arSetupErrors[] = GetMessage("CATI_NO_SAVE_FILE"); } if (empty($arSetupErrors)) { $SETUP_FILE_NAME = str_replace('//','/',$strCatalogDefaultFolder.Rel2Abs("/", $SETUP_FILE_NAME)); if (preg_match(BX_CATALOG_FILENAME_REG, $SETUP_FILE_NAME)) { $arSetupErrors[] = GetMessage("CES_ERROR_BAD_EXPORT_FILENAME"); } elseif ($strCatalogDefaultFolder == $SETUP_FILE_NAME) { $arSetupErrors[] = GetMessage("CATI_NO_SAVE_FILE"); } } if (empty($arSetupErrors)) { if (mb_strtolower(mb_substr($SETUP_FILE_NAME, mb_strlen($SETUP_FILE_NAME) - 4)) != ".csv") $SETUP_FILE_NAME .= ".csv"; if (HasScriptExtension($SETUP_FILE_NAME)) { $arSetupErrors[] = GetMessage("CES_ERROR_BAD_EXPORT_FILENAME_EXTENTIONS"); } } if (empty($arSetupErrors)) { if ($APPLICATION->GetFileAccessPermission($SETUP_FILE_NAME) < "W") { $arSetupErrors[] = str_replace("#FILE#", $SETUP_FILE_NAME, GetMessage('CATI_NO_RIGHTS_FILE')); } else { CheckDirPath($_SERVER["DOCUMENT_ROOT"].$SETUP_FILE_NAME); if (!($fp = fopen($_SERVER["DOCUMENT_ROOT"].$SETUP_FILE_NAME, "wb"))) { $arSetupErrors[] = GetMessage("CATI_CANNOT_CREATE_FILE"); } else { fclose($fp); unlink($_SERVER["DOCUMENT_ROOT"].$SETUP_FILE_NAME); } } } $bFieldsPres = (!empty($field_needed) && is_array($field_needed) && in_array('Y', $field_needed)); if ($bFieldsPres && (empty($field_code) || !is_array($field_code))) { $bFieldsPres = false; } if (!$bFieldsPres) { $arSetupErrors[] = GetMessage("CATI_NO_FIELDS"); } $CML2_LINK_IS_XML = (isset($CML2_LINK_IS_XML) && $CML2_LINK_IS_XML == 'Y' ? 'Y' : 'N'); if (isset($_POST['MAX_EXECUTION_TIME']) && is_string($_POST['MAX_EXECUTION_TIME'])) $maxExecutionTime = $_POST['MAX_EXECUTION_TIME']; $maxExecutionTime = (!isset($maxExecutionTime) ? 0 : (int)$maxExecutionTime); if ($maxExecutionTime < 0) $maxExecutionTime = 0; if (($ACTION=="EXPORT_SETUP" || $ACTION == 'EXPORT_EDIT' || $ACTION == 'EXPORT_COPY') && (!isset($SETUP_PROFILE_NAME) || $SETUP_PROFILE_NAME == '')) { $arSetupErrors[] = GetMessage("CET_ERROR_NO_NAME"); } if (!empty($arSetupErrors)) { $STEP = 2; } } //******************** END ACTIONS **********************************// $aMenu = array( array( "TEXT" => GetMessage("CATI_ADM_RETURN_TO_LIST"), "TITLE" => GetMessage("CATI_ADM_RETURN_TO_LIST_TITLE"), "LINK" => "/bitrix/admin/cat_export_setup.php?lang=".LANGUAGE_ID, "ICON" => "btn_list", ) ); $context = new CAdminContextMenu($aMenu); $context->Show(); if (!empty($arSetupErrors)) ShowError(implode('
', $arSetupErrors)); $actionParams = ""; if ($adminSidePanelHelper->isSidePanel()) { $actionParams = "?IFRAME=Y&IFRAME_TYPE=SIDE_SLIDER"; } ?>
"edit1", "TAB" => GetMessage("CAT_ADM_CSV_EXP_TAB1"), "ICON" => "store", "TITLE" => GetMessage("CAT_ADM_CSV_EXP_TAB1_TITLE")), array("DIV" => "edit2", "TAB" => GetMessage("CAT_ADM_CSV_EXP_TAB2"), "ICON" => "store", "TITLE" => GetMessage("CAT_ADM_CSV_EXP_TAB2_TITLE")), array("DIV" => "edit3", "TAB" => GetMessage("CAT_ADM_CSV_EXP_TAB3"), "ICON" => "store", "TITLE" => GetMessage("CAT_ADM_CSV_EXP_TAB3_TITLE")), ); $tabControl = new CAdminTabControl("tabControl", $aTabs, false, true); $tabControl->Begin(); $tabControl->BeginNextTab(); if ($STEP == 1) { ?> : 'Y','MIN_PERMISSION' => 'U'), '', '', 'class="adm-detail-iblock-types"', 'class="adm-detail-iblock-list"' ); ?> EndTab(); $tabControl->BeginNextTab(); if ($STEP == 2) { ?> : >
>
>
>
> > $IBLOCK_ID), false, false, array('IBLOCK_ID', 'PRODUCT_IBLOCK_ID', 'SKU_PROPERTY_ID') ); if ($arCatalog = $rsCatalogs->Fetch()) { $boolCatalog = true; $boolOffers = ((int)$arCatalog['PRODUCT_IBLOCK_ID'] > 0); } $allowedProductFields = array(); $allowedSectionFields = array(); $allowedPriceQuantityFields = CCatalogCSVSettings::getDefaultSettings(CCatalogCSVSettings::FIELDS_PRICE_EXT, true); $allowedPriceFields = array(); $fieldsOption = trim(COption::GetOptionString('catalog', 'allowed_product_fields')); if ($fieldsOption != '') { $allowedProductFields = explode(',', $fieldsOption); } $fieldsOption = trim(COption::GetOptionString('catalog', 'allowed_group_fields')); if ($fieldsOption != '') { $allowedSectionFields = explode(',', $fieldsOption); } if ($boolCatalog) { $fieldsOption = trim(COption::GetOptionString('catalog', 'allowed_price_fields')); if ($fieldsOption != '') { $allowedPriceFields = explode(',', $fieldsOption); } } $arAvailFields = array(); $intCount = 0; $boolSep = true; if (!empty($allowedProductFields)) { $elementFields = CCatalogCSVSettings::getSettingsFields(CCatalogCSVSettings::FIELDS_ELEMENT, true); foreach ($allowedProductFields as &$fieldName) { if (isset($elementFields[$fieldName])) { $arAvailFields[$intCount] = $elementFields[$fieldName]; $arAvailFields[$intCount]['sort'] = ($intCount+1)*10; if ($boolSep) { $arAvailFields[$intCount]['SEP'] = GetMessage('CAT_ADM_CSV_EXP_SEP_ELEMENTS'); $boolSep = false; } $intCount++; } } unset($fieldName, $elementFields); } $properties = CIBlockProperty::GetList(array("SORT"=>"ASC", "ID"=>"ASC"), array("IBLOCK_ID"=>$IBLOCK_ID, "ACTIVE"=>"Y", 'CHECK_PERMISSIONS' => 'N')); while ($prop_fields = $properties->Fetch()) { $prop_fields['CODE'] = (string)$prop_fields['CODE']; if ($prop_fields['CODE'] === '') $prop_fields['CODE'] = $prop_fields['ID']; $arAvailFields[$intCount] = array( "value" => "IP_PROP".$prop_fields["ID"], "name" => GetMessage("CATI_FI_PROPS").' "'.$prop_fields["NAME"].'"'.' ['.$prop_fields['CODE'].']', 'sort' => ($intCount+1)*10, ); if ($boolSep) { $arAvailFields[$intCount]['SEP'] = GetMessage('CAT_ADM_CSV_EXP_SEP_ELEMENTS'); $boolSep = false; } $intCount++; } if (isset($prop_fields)) unset($prop_fields); unset($properties); $boolSep = true; if (!empty($allowedSectionFields)) { $sectionFields = CCatalogCSVSettings::getSettingsFields(CCatalogCSVSettings::FIELDS_SECTION, true); $selectedSectionFields = array(); foreach ($allowedSectionFields as &$fieldName) { if (isset($sectionFields[$fieldName])) { $selectedSectionFields[] = $sectionFields[$fieldName]; } } unset($fieldName, $allowedSectionFields, $sectionFields); if (!empty($selectedSectionFields)) { for ($currentDepthLevel = 0; $currentDepthLevel < $maxDepthLevel; $currentDepthLevel++) { $subSep = true; foreach ($selectedSectionFields as &$oneField) { $arAvailFields[$intCount] = $oneField; $arAvailFields[$intCount]['value'] .= $currentDepthLevel; $arAvailFields[$intCount]['sort'] = ($intCount+1)*10; if ($boolSep) { $arAvailFields[$intCount]['SEP'] = GetMessage('CAT_ADM_CSV_EXP_SEP_SECTIONS'); $boolSep = false; } if ($subSep) { $arAvailFields[$intCount]['SUB_SEP'] = str_replace('#LEVEL#',($currentDepthLevel+1),GetMessage("CAT_ADM_CSV_EXP_SECTION_LEVEL")); $subSep = false; } $intCount++; } unset($oneField); } } unset($selectedSectionFields); } if ($boolCatalog) { if (!empty($allowedProductFields)) { $boolSep = true; $productFields = CCatalogCSVSettings::getSettingsFields(CCatalogCSVSettings::FIELDS_CATALOG, true); foreach ($allowedProductFields as &$fieldName) { if (isset($productFields[$fieldName])) { $arAvailFields[$intCount] = $productFields[$fieldName]; $arAvailFields[$intCount]['sort'] = ($intCount+1)*10; if ($boolSep) { $arAvailFields[$intCount]['SEP'] = GetMessage('CAT_ADM_CSV_EXP_SEP_PRODUCT'); $boolSep = false; } $intCount++; } } unset($fieldName, $productFields); } if (!empty($allowedPriceFields)) { $boolSep = true; $priceQuantityFields = CCatalogCSVSettings::getSettingsFields(CCatalogCSVSettings::FIELDS_PRICE_EXT, true); foreach ($allowedPriceQuantityFields as &$fieldName) { if (isset($priceQuantityFields[$fieldName])) { $arAvailFields[$intCount] = $priceQuantityFields[$fieldName]; $arAvailFields[$intCount]['sort'] = ($intCount+1)*10; if ($boolSep) { $arAvailFields[$intCount]['SEP'] = GetMessage('CAT_ADM_CSV_EXP_SEP_PRICES'); $boolSep = false; } $intCount++; } } unset($fieldName, $priceQuantityFields); $priceFields = CCatalogCSVSettings::getSettingsFields(CCatalogCSVSettings::FIELDS_PRICE, true); $rsPriceTypes = CCatalogGroup::GetListEx( array('SORT' => 'ASC', 'ID' => 'ASC'), array(), false, false, array('ID', 'NAME', 'NAME_LANG') ); while ($priceType = $rsPriceTypes->Fetch()) { $priceType['NAME_LANG'] = (string)$priceType['NAME_LANG']; foreach ($allowedPriceFields as &$fieldName) { if (isset($priceFields[$fieldName])) { $priceName = ($priceType['NAME_LANG'] !== '' ? str_replace(array('#TYPE#', '#NAME#'), array($priceType['NAME'], $priceType['NAME_LANG']), GetMessage('EST_PRICE_TYPE2')): str_replace("#TYPE#", $priceType['NAME'], GetMessage('EST_PRICE_TYPE')) ); $arAvailFields[$intCount] = $priceFields[$fieldName]; $arAvailFields[$intCount]['value'] .= '_'.$priceType['ID']; $arAvailFields[$intCount]['name'] = $priceName.': '.$arAvailFields[$intCount]['name']; $arAvailFields[$intCount]['sort'] = ($intCount+1)*10; if ($boolSep) { $arAvailFields[$intCount]['SEP'] = GetMessage('CAT_ADM_CSV_EXP_SEP_PRICES'); $boolSep = false; } $intCount++; } } unset($fieldName); } unset($priceType, $rsPriceTypes, $priceFields); } } $intCountAvailFields = $intCount; $intCountChecked = 0; $arCheckID = array(); $boolAll = true; if (isset($field_code) && !empty($field_code) && is_array($field_code)) { foreach ($arAvailFields as $i => $arOneAvailField) { $intSort = 0; $key = array_search($arOneAvailField['value'], $field_code); if (false !== $key) { if (isset($field_needed[$key]) && 'Y' == $field_needed[$key]) { $boolAll = false; $arCheckID[] = $arOneAvailField['value']; $intCountChecked++; } if (isset($field_num[$key]) && 0 < intval($field_num[$key])) $intSort = intval($field_num[$key]); } if (0 < $intSort) $arAvailFields[$i]['sort'] = $intSort; } } if ($boolAll) $intCountChecked = $intCountAvailFields; ?> $arOneAvailField) { if (!empty($arOneAvailField['SEP'])) { ?>
  
value="Y" onclick="checkOne(this,);"> ";?> ";?> ";?> "> ";?>
: > > >
Fatal error: Uncaught Error: Call to undefined function GetMessage() in D:\ktt\ttepla.com\public_html\bitrix\modules\catalog\load\csv_new_setup.php:649 Stack trace: #0 {main} thrown in D:\ktt\ttepla.com\public_html\bitrix\modules\catalog\load\csv_new_setup.php on line 649