2013-09-12 17:31:32 +04:00
|
|
|
|
<?php
|
|
|
|
|
|
2015-03-19 15:09:37 +03:00
|
|
|
|
ignore_user_abort(true);
|
2013-09-12 17:31:32 +04:00
|
|
|
|
set_time_limit(0);
|
|
|
|
|
|
|
|
|
|
global $APPLICATION;
|
|
|
|
|
if (!CModule::IncludeModule("iblock"))
|
|
|
|
|
return;
|
|
|
|
|
if (!CModule::IncludeModule("catalog"))
|
|
|
|
|
return;
|
|
|
|
|
if (!CModule::IncludeModule("intaro.intarocrm"))
|
|
|
|
|
return;
|
|
|
|
|
|
2015-03-03 16:37:34 +03:00
|
|
|
|
$rsSites = CSite::GetList($by, $sort, array('ACTIVE' => 'Y'));
|
|
|
|
|
while ($ar = $rsSites->Fetch()){
|
|
|
|
|
if($ar['DEF'] == 'Y'){
|
|
|
|
|
$SERVER_NAME = $ar['SERVER_NAME'];//разделить потом с учетом многосайтовости
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2013-10-02 17:42:20 +04:00
|
|
|
|
$iblockProperties = Array(
|
|
|
|
|
"article" => "article",
|
|
|
|
|
"manufacturer" => "manufacturer",
|
|
|
|
|
"color" =>"color",
|
|
|
|
|
"weight" => "weight",
|
|
|
|
|
"size" => "size",
|
2014-01-23 16:55:04 +04:00
|
|
|
|
"length" => "length",
|
|
|
|
|
"width" => "width",
|
|
|
|
|
"height" => "height",
|
2013-10-02 17:42:20 +04:00
|
|
|
|
);
|
|
|
|
|
$IBLOCK_PROPERTY_SKU = array();
|
2014-01-23 16:55:04 +04:00
|
|
|
|
$IBLOCK_PROPERTY_UNIT_SKU = array();
|
2013-10-02 17:42:20 +04:00
|
|
|
|
foreach ($iblockProperties as $prop) {
|
2014-04-15 20:31:11 +04:00
|
|
|
|
|
2014-01-23 16:55:04 +04:00
|
|
|
|
$skuUnitProps = ('IBLOCK_PROPERTY_UNIT_SKU' . "_" . $prop);
|
|
|
|
|
$skuUnitProps = $$skuUnitProps;
|
2014-01-30 15:54:49 +04:00
|
|
|
|
if (is_array($skuUnitProps)) {
|
|
|
|
|
foreach ($skuUnitProps as $iblock => $val) {
|
|
|
|
|
$IBLOCK_PROPERTY_UNIT_SKU[$iblock][$prop] = $val;
|
|
|
|
|
}
|
2014-01-23 16:55:04 +04:00
|
|
|
|
}
|
2014-04-15 20:31:11 +04:00
|
|
|
|
|
2013-10-02 17:42:20 +04:00
|
|
|
|
$skuProps = ('IBLOCK_PROPERTY_SKU' . "_" . $prop);
|
|
|
|
|
$skuProps = $$skuProps;
|
2014-01-30 15:54:49 +04:00
|
|
|
|
if (is_array($skuProps)) {
|
|
|
|
|
foreach ($skuProps as $iblock => $val) {
|
|
|
|
|
$IBLOCK_PROPERTY_SKU[$iblock][$prop] = $val;
|
|
|
|
|
}
|
2013-10-02 17:42:20 +04:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
$IBLOCK_PROPERTY_PRODUCT = array();
|
2014-01-23 16:55:04 +04:00
|
|
|
|
$IBLOCK_PROPERTY_UNIT_PRODUCT = array();
|
2013-10-02 17:42:20 +04:00
|
|
|
|
foreach ($iblockProperties as $prop) {
|
2014-04-15 20:31:11 +04:00
|
|
|
|
|
2014-01-23 16:55:04 +04:00
|
|
|
|
$productUnitProps = "IBLOCK_PROPERTY_UNIT_PRODUCT" . "_" . $prop;
|
|
|
|
|
$productUnitProps = $$productUnitProps;
|
2014-01-30 15:54:49 +04:00
|
|
|
|
if (is_array($productUnitProps)) {
|
|
|
|
|
foreach ($productUnitProps as $iblock => $val) {
|
|
|
|
|
$IBLOCK_PROPERTY_UNIT_PRODUCT[$iblock][$prop] = $val;
|
|
|
|
|
}
|
2014-01-23 16:55:04 +04:00
|
|
|
|
}
|
2014-04-15 20:31:11 +04:00
|
|
|
|
|
2014-01-23 16:55:04 +04:00
|
|
|
|
$productProps = "IBLOCK_PROPERTY_PRODUCT" . "_" . $prop;
|
|
|
|
|
$productProps = $$productProps;
|
2014-01-30 15:54:49 +04:00
|
|
|
|
if (is_array($productProps)) {
|
|
|
|
|
foreach ($productProps as $iblock => $val) {
|
|
|
|
|
$IBLOCK_PROPERTY_PRODUCT[$iblock][$prop] = $val;
|
|
|
|
|
}
|
2013-10-02 17:42:20 +04:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2013-09-12 17:31:32 +04:00
|
|
|
|
$loader = new ICMLLoader();
|
2015-03-19 15:09:37 +03:00
|
|
|
|
$loader->profileID = $PROFILE_ID;
|
2013-09-12 17:31:32 +04:00
|
|
|
|
$loader->iblocks = $IBLOCK_EXPORT;
|
2013-09-13 16:15:54 +04:00
|
|
|
|
$loader->propertiesSKU = $IBLOCK_PROPERTY_SKU;
|
2014-01-23 16:55:04 +04:00
|
|
|
|
$loader->propertiesUnitSKU = $IBLOCK_PROPERTY_UNIT_SKU;
|
2013-09-13 16:15:54 +04:00
|
|
|
|
$loader->propertiesProduct = $IBLOCK_PROPERTY_PRODUCT;
|
2014-01-23 16:55:04 +04:00
|
|
|
|
$loader->propertiesUnitProduct = $IBLOCK_PROPERTY_UNIT_PRODUCT;
|
2013-09-12 17:31:32 +04:00
|
|
|
|
$loader->filename = $SETUP_FILE_NAME;
|
2015-03-03 16:37:34 +03:00
|
|
|
|
$loader->serverName = $SERVER_NAME;
|
2013-09-12 17:31:32 +04:00
|
|
|
|
$loader->application = $APPLICATION;
|
2014-04-15 20:31:11 +04:00
|
|
|
|
$loader->loadPurchasePrice = $LOAD_PURCHASE_PRICE == 'Y';
|
2013-09-12 17:31:32 +04:00
|
|
|
|
$loader->Load();
|