0 7 * * * /usr/bin/php -f /home/bitrix/ext_www/site.ru/bitrix/php_interface/include/catalog_export/cron_frame.php 7
AddEventHandler("catalog", "OnSuccessCatalogImport1C", "DSOnSuccessCatalogImport1C");
function DSOnSuccessCatalogImport1C(&$arParams,&$arFields){
// как здесь запустить экспорт каталога по ID
}
$profile_id = 7;
$ar_profile = CCatalogExport::GetByID($profile_id);
if (!$ar_profile)
die('No profile');
$strFile = CATALOG_PATH2EXPORTS.$ar_profile["FILE_NAME"]."_run.php";
if (!file_exists($_SERVER["DOCUMENT_ROOT"].$strFile))
{
$strFile = CATALOG_PATH2EXPORTS_DEF.$ar_profile["FILE_NAME"]."_run.php";
if (!file_exists($_SERVER["DOCUMENT_ROOT"].$strFile))
die('No export script');
}
$arSetupVars = array();
$intSetupVarsCount = 0;
if ($ar_profile["DEFAULT_PROFILE"] != 'Y')
{
parse_str($ar_profile["SETUP_VARS"], $arSetupVars);
if (!empty($arSetupVars) && is_array($arSetupVars))
$intSetupVarsCount = extract($arSetupVars, EXTR_SKIP);
}
$firstStep = true;
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();