array('TABLE_NAME' => $_POST['table']))); $hlblockArr = $rsData->Fetch(); $hlblock = \Bitrix\Highloadblock\HighloadBlockTable::getById($hlblockArr["ID"])->fetch(); $entity = \Bitrix\Highloadblock\HighloadBlockTable::compileEntity($hlblock); $hbFields = $entity->getFields(); $hlblockList['table'] = $hlblockArr["TABLE_NAME"]; foreach ($hbFields as $hbFieldCode => $hbField) { $hlblockList['fields'][] = $hbFieldCode; } $APPLICATION->RestartBuffer(); header('Content-Type: application/x-javascript; charset=' . LANG_CHARSET); die(json_encode($hlblockList)); } $iblockProperties = array( "article" => "article", "manufacturer" => "manufacturer", "color" =>"color", "size" => "size", "weight" => "weight", "length" => "length", "width" => "width", "height" => "height", "picture" => "picture" ); if (!check_bitrix_sessid()) { return; } __IncludeLang(GetLangFileName($_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/intaro.retailcrm/lang/", "/icml_export_setup.php")); $MODULE_ID = 'intaro.retailcrm'; $CRM_CATALOG_BASE_PRICE = 'catalog_base_price'; $basePriceId = COption::GetOptionString($MODULE_ID, $CRM_CATALOG_BASE_PRICE . '_' . $_REQUEST['PROFILE_ID'], 1); $arResult['PRICE_TYPES'] = array(); $dbPriceType = CCatalogGroup::GetList( array("SORT" => "ASC"), array(), array(), array(), array("ID", "NAME", "BASE") ); while ($arPriceType = $dbPriceType->Fetch()) { $arResult['PRICE_TYPES'][$arPriceType['ID']] = $arPriceType; } //highloadblock if (CModule::IncludeModule('highloadblock')) { $hlblockModule = true; $hlblockList = array(); $hlblockListDb = \Bitrix\Highloadblock\HighloadBlockTable::getList(); while ($hlblockArr = $hlblockListDb->Fetch()) { $hlblock = \Bitrix\Highloadblock\HighloadBlockTable::getById($hlblockArr["ID"])->fetch(); $entity = \Bitrix\Highloadblock\HighloadBlockTable::compileEntity($hlblock); $hbFields = $entity->getFields(); $hlblockList[$hlblockArr["TABLE_NAME"]]['LABEL'] = $hlblockArr["NAME"]; foreach ($hbFields as $hbFieldCode => $hbField) { $hlblockList[$hlblockArr["TABLE_NAME"]]['FIELDS'][] = $hbFieldCode; } } } if (($ACTION == 'EXPORT' || $ACTION == 'EXPORT_EDIT' || $ACTION == 'EXPORT_COPY') && $STEP == 1) { if (isset($arOldSetupVars['SETUP_FILE_NAME'])) $SETUP_FILE_NAME = $arOldSetupVars['SETUP_FILE_NAME']; if (isset($arOldSetupVars['LOAD_PURCHASE_PRICE'])) $LOAD_PURCHASE_PRICE = $arOldSetupVars['LOAD_PURCHASE_PRICE']; if (isset($arOldSetupVars['SETUP_PROFILE_NAME'])) $SETUP_PROFILE_NAME = $arOldSetupVars['SETUP_PROFILE_NAME']; if (isset($arOldSetupVars['IBLOCK_EXPORT'])) $IBLOCK_EXPORT = $arOldSetupVars['IBLOCK_EXPORT']; if (isset($arOldSetupVars['IBLOCK_EXPORT'])) $MAX_OFFERS_VALUE = $arOldSetupVars['MAX_OFFERS_VALUE']; $IBLOCK_PROPERTY_SKU = []; $IBLOCK_PROPERTY_UNIT_SKU = []; foreach ($iblockProperties as $prop) { foreach ($arOldSetupVars['IBLOCK_PROPERTY_SKU' . '_' . $prop] as $iblock => $val) { $IBLOCK_PROPERTY_SKU[$iblock][$prop] = $val; } foreach ($arOldSetupVars['IBLOCK_PROPERTY_UNIT_SKU' . '_' . $prop] as $iblock => $val) { $IBLOCK_PROPERTY_UNIT_SKU[$iblock][$prop] = $val; } } $IBLOCK_PROPERTY_PRODUCT = []; $IBLOCK_PROPERTY_UNIT_PRODUCT = []; foreach ($iblockProperties as $prop) { foreach ($arOldSetupVars['IBLOCK_PROPERTY_PRODUCT' . '_' . $prop] as $iblock => $val) { $IBLOCK_PROPERTY_PRODUCT[$iblock][$prop] = $val; } foreach ($arOldSetupVars['IBLOCK_PROPERTY_UNIT_PRODUCT' . '_' . $prop] as $iblock => $val) { $IBLOCK_PROPERTY_UNIT_PRODUCT[$iblock][$prop] = $val; } } } if ($STEP > 1) { if (strlen($SETUP_FILE_NAME)<=0) { $arSetupErrors[] = GetMessage("CET_ERROR_NO_FILENAME"); } elseif ($APPLICATION->GetFileAccessPermission($SETUP_FILE_NAME) < "W") { $arSetupErrors[] = str_replace("#FILE#", $SETUP_FILE_NAME, GetMessage('CET_YAND_RUN_ERR_SETUP_FILE_ACCESS_DENIED')); } if (($ACTION=="EXPORT_SETUP" || $ACTION == 'EXPORT_EDIT' || $ACTION == 'EXPORT_COPY') && strlen($SETUP_PROFILE_NAME)<=0) { $arSetupErrors[] = GetMessage("CET_ERROR_NO_PROFILE_NAME"); } if (!empty($arSetupErrors)) { $STEP = 1; } } if (!empty($arSetupErrors)) echo ShowError(implode('
', $arSetupErrors)); if ($STEP==1) { ?>



GetMessage("PROPERTY_ARTICLE_HEADER_NAME"), "manufacturer" => GetMessage("PROPERTY_MANUFACTURER_HEADER_NAME"), "color" => GetMessage("PROPERTY_COLOR_HEADER_NAME"), "size" => GetMessage("PROPERTY_SIZE_HEADER_NAME"), "weight" => GetMessage("PROPERTY_WEIGHT_HEADER_NAME"), "length" => GetMessage("PROPERTY_LENGTH_HEADER_NAME"), "width" => GetMessage("PROPERTY_WIDTH_HEADER_NAME"), "height" => GetMessage("PROPERTY_HEIGHT_HEADER_NAME"), "picture" => GetMessage("PROPERTY_PICTURE_HEADER_NAME") ); $iblockFieldsName = Array( "weight" => Array("code" => "catalog_weight" , "name" => GetMessage("SELECT_WEIGHT_PROPERTY_NAME"), 'unit' => 'mass'), "length" => Array("code" => "catalog_length" , "name" => GetMessage("SELECT_LENGTH_PROPERTY_NAME"), 'unit' => 'length'), "width" => Array("code" => "catalog_width" , "name" => GetMessage("SELECT_WIDTH_PROPERTY_NAME"), 'unit' => 'length'), "height" => Array("code" => "catalog_height" , "name" => GetMessage("SELECT_HEIGHT_PROPERTY_NAME"), 'unit' => 'length'), ); $iblockPropertiesHint = Array( "article" => Array("ARTICLE", "ART", "ARTNUMBER", "ARTICUL", "ARTIKUL"), "manufacturer" => Array("MANUFACTURER", "PROISVODITEL", "PROISVOD", "PROISV"), "color" => Array("COLOR", "CVET"), "size" => Array("SIZE", "RAZMER"), "weight" => Array("WEIGHT", "VES", "VEC"), "length" => Array("LENGTH", "DLINA"), "width" => Array("WIDTH", "SHIRINA"), "height" => Array("HEIGHT", "VISOTA"), "picture" => Array("PICTURE", "PICTURE") ); $units = Array( 'length' => Array( 'mm' => GetMessage("UNIT_MEASUREMENT_MM"), 'cm' => GetMessage("UNIT_MEASUREMENT_CM"), 'm' => GetMessage("UNIT_MEASUREMENT_M"), ), 'mass' => Array( 'mg' => GetMessage("UNIT_MEASUREMENT_MG"), 'g' => GetMessage("UNIT_MEASUREMENT_G"), 'kg' => GetMessage("UNIT_MEASUREMENT_KG"), ) ); $hintUnit = Array( 'length' => 'mm', 'mass' => 'g' ); $boolAll = false; $intCountChecked = 0; $intCountAvailIBlock = 0; $arIBlockList = array(); $db_res = CIBlock::GetList(Array("IBLOCK_TYPE"=>"ASC", "NAME"=>"ASC"),array('CHECK_PERMISSIONS' => 'Y','MIN_PERMISSION' => 'W')); while ($iblock = $db_res->Fetch()) { if ($arCatalog = CCatalog::GetByIDExt($iblock["ID"])) { if($arCatalog['CATALOG_TYPE'] == "D" || $arCatalog['CATALOG_TYPE'] == "X" || $arCatalog['CATALOG_TYPE'] == "P") { $propertiesSKU = null; if ($arCatalog['CATALOG_TYPE'] == "X" || $arCatalog['CATALOG_TYPE'] == "P") { $iblockOffer = CCatalogSKU::GetInfoByProductIBlock($iblock["ID"]); $db_properties = CIBlock::GetProperties($iblockOffer['IBLOCK_ID'], Array()); while($prop = $db_properties->Fetch()) $propertiesSKU[] = $prop; $oldPropertySKU = null; if (isset($IBLOCK_PROPERTY_SKU[$iblock['ID']])) { foreach ($iblockPropertiesName as $key => $prop) { $oldPropertySKU[$key] = $IBLOCK_PROPERTY_SKU[$iblock['ID']][$key]; } } $oldPropertyUnitSKU = null; if (isset($IBLOCK_PROPERTY_UNIT_SKU[$iblock['ID']])) { foreach ($iblockPropertiesName as $key => $prop) { $oldPropertyUnitSKU[$key] = $IBLOCK_PROPERTY_UNIT_SKU[$iblock['ID']][$key]; } } } $propertiesProduct = null; $db_properties = CIBlock::GetProperties($iblock['ID'], Array()); while($prop = $db_properties->Fetch()) $propertiesProduct[] = $prop; $oldPropertyProduct = null; if (isset($IBLOCK_PROPERTY_PRODUCT[$iblock['ID']])) { foreach ($iblockPropertiesName as $key => $prop) { $oldPropertyProduct[$key] = $IBLOCK_PROPERTY_PRODUCT[$iblock['ID']][$key]; } } $oldPropertyUnitProduct = null; if (isset($IBLOCK_PROPERTY_UNIT_PRODUCT[$iblock['ID']])) { foreach ($iblockPropertiesName as $key => $prop) { $oldPropertyUnitProduct[$key] = $IBLOCK_PROPERTY_UNIT_PRODUCT[$iblock['ID']][$key]; } } $arSiteList = array(); $rsSites = CIBlock::GetSite($iblock["ID"]); while ($arSite = $rsSites->Fetch()) { $arSiteList[] = $arSite["SITE_ID"]; } if (count($IBLOCK_EXPORT) != 0) $boolExport = (in_array($iblock['ID'], $IBLOCK_EXPORT)); else $boolExport = true; $arIBlockList[] = array( 'ID' => $iblock['ID'], 'NAME' => $iblock['NAME'], 'IBLOCK_TYPE_ID' => $iblock['IBLOCK_TYPE_ID'], 'IBLOCK_EXPORT' => $boolExport, 'PROPERTIES_SKU' => $propertiesSKU, 'PROPERTIES_PRODUCT' => $propertiesProduct, 'OLD_PROPERTY_SKU_SELECT' => $oldPropertySKU, 'OLD_PROPERTY_UNIT_SKU_SELECT' => $oldPropertyUnitSKU, 'OLD_PROPERTY_PRODUCT_SELECT' => $oldPropertyProduct, 'OLD_PROPERTY_UNIT_PRODUCT_SELECT' => $oldPropertyUnitProduct, 'SITE_LIST' => '('.implode(' ',$arSiteList).')', ); if ($boolExport) $intCountChecked++; $intCountAvailIBlock++; } } } if (count($IBLOCK_EXPORT) != 0) { if ($intCountChecked == $intCountAvailIBlock) $boolAll = true; } else { $intCountChecked = $intCountAvailIBlock; $boolAll = true; } ?> >

$arIBlock):?>
]" id="IBLOCK_EXPORT" value="" onclick="checkOne(this,);" >

"> > $property): ?>







  >


 












$hlblock) { $vals .= ',highloadblock' . $hlblockTable . '_' . $val; } foreach ($hlblockList as $hlblockTable => $hlblock) { $vals .= ',highloadblock_product' . $hlblockTable . '_' . $val; } } } ?> "> ">