diff --git a/intaro.intarocrm/update.php b/intaro.intarocrm/update.php new file mode 100644 index 00000000..29166cfb --- /dev/null +++ b/intaro.intarocrm/update.php @@ -0,0 +1,109 @@ + "Y", "FILE_NAME" => "intarocrm") +); +while ($arProfile = $dbProfile->Fetch()) +{ + $PROFILE_ID = intval($arProfile["ID"]); + + parse_str($arProfile['SETUP_VARS']); + + $propertiesSKU = Array(); + $propertiesProduct = Array(); + + foreach ($IBLOCK_EXPORT as $iblock) { + + $propertiesSKU[$iblock] = Array( + "article" => null, + "manufacturer" => null, + "color" => null, + "weight" => null, + "size" => null, + ); + + $propertiesProduct[$iblock] = Array( + "article" => $IBLOCK_PROPERTY_ARTICLE[$iblock], + "manufacturer" => null, + "color" => null, + "weight" => null, + "size" => null, + ); + } + + $strVars = GetProfileSetupVars($IBLOCK_EXPORT, $propertiesProduct, $propertiesSKU, $SETUP_FILE_NAME); + + CCatalogExport::Update( + $PROFILE_ID, + array( + "SETUP_VARS" => $strVars + ) + ); + + +} + +function GetProfileSetupVars($iblocks, $propertiesProduct, $propertiesSKU, $filename) { + + $strVars = ""; + foreach ($iblocks as $key => $val) + $strVars .= 'IBLOCK_EXPORT[' . $key . ']=' . $val . '&'; + foreach ($propertiesSKU as $iblock => $arr) + foreach ($arr as $id => $val) + $strVars .= 'IBLOCK_PROPERTY_SKU[' . $iblock . '][' . $id . ']=' . $val . '&'; + foreach ($propertiesProduct as $iblock => $arr) + foreach ($arr as $id => $val) + $strVars .= 'IBLOCK_PROPERTY_PRODUCT[' . $iblock . '][' . $id . ']=' . $val . '&'; + + $strVars .= 'SETUP_FILE_NAME=' . urlencode($filename); + + return $strVars; +}