echo GetMessage("CAT_ADM_CSV_EXP_IBLOCK_ID"); ?>: |
if (!isset($IBLOCK_ID))
$IBLOCK_ID = 0;
echo GetIBlockDropDownListEx(
$IBLOCK_ID,
'IBLOCK_TYPE_ID',
'IBLOCK_ID',
array('CHECK_PERMISSIONS' => 'Y','MIN_PERMISSION' => 'U'),
'',
'',
'class="adm-detail-iblock-types"',
'class="adm-detail-iblock-list"'
);
?> |
}
$tabControl->EndTab();
$tabControl->BeginNextTab();
if ($STEP == 2)
{
?>
$boolCatalog = false;
$boolOffers = false;
$rsCatalogs = CCatalog::GetList(
array(),
array('IBLOCK_ID' => $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;
?>
>
|
|
|
foreach ($arAvailFields as $i => $arOneAvailField)
{
if (!empty($arOneAvailField['SEP']))
{
?> echo htmlspecialcharsbx($arOneAvailField['SEP']); ?> |
}
if (!empty($arOneAvailField['SUB_SEP']))
{
?> | echo htmlspecialcharsbx($arOneAvailField['SUB_SEP']); ?> | |
}
?>
value="Y" onclick="checkOne(this, echo $intCountAvailFields; ?>);"> |
";?>
";?>
|
";?>
">
";?>
|
}
?>
|