示例#1
0
 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++;
示例#2
0
    $defCatalogAvailProdFields = CCatalogCSVSettings::getDefaultSettings(CCatalogCSVSettings::FIELDS_ELEMENT);
}
if (!isset($defCatalogAvailPriceFields)) {
    $defCatalogAvailPriceFields = CCatalogCSVSettings::getDefaultSettings(CCatalogCSVSettings::FIELDS_CATALOG);
}
if (!isset($defCatalogAvailValueFields)) {
    $defCatalogAvailValueFields = CCatalogCSVSettings::getDefaultSettings(CCatalogCSVSettings::FIELDS_PRICE);
}
if (!isset($defCatalogAvailQuantityFields)) {
    $defCatalogAvailQuantityFields = CCatalogCSVSettings::getDefaultSettings(CCatalogCSVSettings::FIELDS_PRICE_EXT);
}
if (!isset($defCatalogAvailGroupFields)) {
    $defCatalogAvailGroupFields = CCatalogCSVSettings::getDefaultSettings(CCatalogCSVSettings::FIELDS_SECTION);
}
if (!isset($defCatalogAvailCurrencies)) {
    $defCatalogAvailCurrencies = CCatalogCSVSettings::getDefaultSettings(CCatalogCSVSettings::FIELDS_CURRENCY);
}
$NUM_CATALOG_LEVELS = intval(COption::GetOptionString("catalog", "num_catalog_levels"));
$max_execution_time = intval($max_execution_time);
if ($max_execution_time <= 0) {
    $max_execution_time = 0;
}
if (defined('BX_CAT_CRON') && true == BX_CAT_CRON) {
    $max_execution_time = 0;
}
if (defined("CATALOG_LOAD_NO_STEP") && CATALOG_LOAD_NO_STEP) {
    $max_execution_time = 0;
}
$bAllLinesLoaded = true;
$io = CBXVirtualIo::GetInstance();
if (!function_exists('CSVCheckTimeout')) {
示例#3
0
		<td width="60%"><?
			$strVal = (int)Option::get('catalog', 'num_catalog_levels');
			?><input type="text" size="5" maxlength="5" value="<? echo $strVal; ?>" name="num_catalog_levels">
		</td>
	</tr>
	<tr>
		<td width="40%" valign="top"><?echo Loc::getMessage("CO_PAR_DPG_CSV") ?></td>
		<td width="60%">
	<?
	$arVal = array();
	$strVal = (string)Option::get('catalog', 'allowed_group_fields');
	if ($strVal != '')
	{
		$arVal = array_fill_keys(explode(',', $strVal), true);
	}
	$sectionFields = CCatalogCSVSettings::getSettingsFields(CCatalogCSVSettings::FIELDS_SECTION);
	?><select name="allowed_group_fields[]" multiple size="9"><?
	foreach ($sectionFields as &$oneField)
	{
		?><option value="<? echo htmlspecialcharsbx($oneField['value']); ?>"<? echo (isset($arVal[$oneField['value']]) ? ' selected' : ''); ?>><? echo htmlspecialcharsex($oneField['name']); ?></option><?
	}
	if (isset($oneField))
		unset($oneField);
	unset($sectionFields);
	?></select>
		</td>
	</tr>
	<tr>
		<td width="40%" valign="top"><?echo Loc::getMessage("CO_PAR_DV1_CSV")?></td>
		<td width="60%" valign="top">
	<?
示例#4
0
 public static function PreGenerateImport($profile_id)
 {
     global $DB;
     $profile_id = (int) $profile_id;
     if ($profile_id <= 0) {
         return false;
     }
     $ar_profile = CCatalogImport::GetByID($profile_id);
     if (!$ar_profile || 'Y' == $ar_profile['NEED_EDIT']) {
         return false;
     }
     $strFile = CATALOG_PATH2IMPORTS . $ar_profile["FILE_NAME"] . "_run.php";
     if (!file_exists($_SERVER["DOCUMENT_ROOT"] . $strFile)) {
         $strFile = CATALOG_PATH2IMPORTS_DEF . $ar_profile["FILE_NAME"] . "_run.php";
         if (!file_exists($_SERVER["DOCUMENT_ROOT"] . $strFile)) {
             CCatalogDiscountSave::Enable();
             return false;
         }
     }
     $bFirstLoadStep = true;
     if (!defined("CATALOG_LOAD_NO_STEP")) {
         define("CATALOG_LOAD_NO_STEP", true);
     }
     $strImportErrorMessage = "";
     $strImportOKMessage = "";
     $bAllDataLoaded = true;
     $arSetupVars = array();
     $intSetupVarsCount = 0;
     if ('Y' != $ar_profile["DEFAULT_PROFILE"]) {
         parse_str($ar_profile["SETUP_VARS"], $arSetupVars);
         if (!empty($arSetupVars) && is_array($arSetupVars)) {
             $intSetupVarsCount = extract($arSetupVars, EXTR_SKIP);
         }
     }
     global $arCatalogAvailProdFields;
     $arCatalogAvailProdFields = CCatalogCSVSettings::getSettingsFields(CCatalogCSVSettings::FIELDS_ELEMENT);
     global $arCatalogAvailPriceFields;
     $arCatalogAvailPriceFields = CCatalogCSVSettings::getSettingsFields(CCatalogCSVSettings::FIELDS_CATALOG);
     global $arCatalogAvailValueFields;
     $arCatalogAvailValueFields = CCatalogCSVSettings::getSettingsFields(CCatalogCSVSettings::FIELDS_PRICE);
     global $arCatalogAvailQuantityFields;
     $arCatalogAvailQuantityFields = CCatalogCSVSettings::getSettingsFields(CCatalogCSVSettings::FIELDS_PRICE_EXT);
     global $arCatalogAvailGroupFields;
     $arCatalogAvailGroupFields = CCatalogCSVSettings::getSettingsFields(CCatalogCSVSettings::FIELDS_SECTION);
     global $defCatalogAvailProdFields;
     $defCatalogAvailProdFields = CCatalogCSVSettings::getDefaultSettings(CCatalogCSVSettings::FIELDS_ELEMENT);
     global $defCatalogAvailPriceFields;
     $defCatalogAvailPriceFields = CCatalogCSVSettings::getDefaultSettings(CCatalogCSVSettings::FIELDS_CATALOG);
     global $defCatalogAvailValueFields;
     $defCatalogAvailValueFields = CCatalogCSVSettings::getDefaultSettings(CCatalogCSVSettings::FIELDS_PRICE);
     global $defCatalogAvailQuantityFields;
     $defCatalogAvailQuantityFields = CCatalogCSVSettings::getDefaultSettings(CCatalogCSVSettings::FIELDS_PRICE_EXT);
     global $defCatalogAvailGroupFields;
     $defCatalogAvailGroupFields = CCatalogCSVSettings::getDefaultSettings(CCatalogCSVSettings::FIELDS_SECTION);
     global $defCatalogAvailCurrencies;
     $defCatalogAvailCurrencies = CCatalogCSVSettings::getDefaultSettings(CCatalogCSVSettings::FIELDS_CURRENCY);
     CCatalogDiscountSave::Disable();
     include $_SERVER["DOCUMENT_ROOT"] . $strFile;
     CCatalogDiscountSave::Enable();
     CCatalogImport::Update($profile_id, array("=LAST_USE" => $DB->GetNowFunction()));
     return "CCatalogImport::PreGenerateImport(" . $profile_id . ");";
 }