diff --git a/.gitignore b/.gitignore new file mode 100644 index 00000000..840e40b3 --- /dev/null +++ b/.gitignore @@ -0,0 +1,11 @@ +.DS_Store +*~ +/nbproject/* +/.idea/* +/*tags* +.idea +.idea/* +/.idea +/.idea/* +.travis.yml + diff --git a/intaro.intarocrm/classes/general/ICMLLoader.php b/intaro.intarocrm/classes/general/ICMLLoader.php index 6bc81ad9..db1ce1f5 100644 --- a/intaro.intarocrm/classes/general/ICMLLoader.php +++ b/intaro.intarocrm/classes/general/ICMLLoader.php @@ -14,6 +14,7 @@ class ICMLLoader { public $application; public $encoding = 'utf-8'; public $encodingDefault = 'utf-8'; + public $loadPurchasePrice = false; protected $fp; protected $mainSection = 1000000; @@ -394,6 +395,7 @@ class ICMLLoader { $offer['PRODUCT_NAME'] = $product["NAME"]; $offer['PRODUCT_ACTIVE'] = $product["ACTIVE"]; $offer['PRICE'] = $offer['CATALOG_PRICE_1']; + $offer['PURCHASE_PRICE'] = $offer['CATALOG_PURCHASING_PRICE']; $offer['QUANTITY'] = $offer["CATALOG_QUANTITY"]; // Get properties of product @@ -432,6 +434,7 @@ class ICMLLoader { $product['PRODUCT_NAME'] = $product["NAME"]; $product['PRODUCT_ACTIVE'] = $product["ACTIVE"]; $product['PRICE'] = $product['CATALOG_PRICE_1']; + $product['PURCHASE_PRICE'] = $product['CATALOG_PURCHASING_PRICE']; $product['QUANTITY'] = $product["CATALOG_QUANTITY"]; foreach ($resPropertiesProduct as $key => $propProduct) { @@ -494,6 +497,9 @@ class ICMLLoader { $offer .= "" . ($_SERVER["HTTPS"] == 'on' ? "https://" : "http://") . $_SERVER['SERVER_NAME'] . $this->PrepareValue($arOffer['DETAIL_PAGE_URL']) . "\n"; $offer .= "" . $this->PrepareValue($arOffer['PRICE']) . "\n"; + if ($arOffer['PURCHASE_PRICE'] && $this->loadPurchasePrice) { + $offer .= "" . $this->PrepareValue($arOffer['PURCHASE_PRICE']) . "\n"; + } foreach ($categories as $category) $offer .= "" . $category['ID'] . "\n"; diff --git a/intaro.intarocrm/export/export_run.php b/intaro.intarocrm/export/export_run.php index 23a67acd..160ea9db 100644 --- a/intaro.intarocrm/export/export_run.php +++ b/intaro.intarocrm/export/export_run.php @@ -23,7 +23,7 @@ $iblockProperties = Array( $IBLOCK_PROPERTY_SKU = array(); $IBLOCK_PROPERTY_UNIT_SKU = array(); foreach ($iblockProperties as $prop) { - + $skuUnitProps = ('IBLOCK_PROPERTY_UNIT_SKU' . "_" . $prop); $skuUnitProps = $$skuUnitProps; if (is_array($skuUnitProps)) { @@ -31,7 +31,7 @@ foreach ($iblockProperties as $prop) { $IBLOCK_PROPERTY_UNIT_SKU[$iblock][$prop] = $val; } } - + $skuProps = ('IBLOCK_PROPERTY_SKU' . "_" . $prop); $skuProps = $$skuProps; if (is_array($skuProps)) { @@ -43,7 +43,7 @@ foreach ($iblockProperties as $prop) { $IBLOCK_PROPERTY_PRODUCT = array(); $IBLOCK_PROPERTY_UNIT_PRODUCT = array(); foreach ($iblockProperties as $prop) { - + $productUnitProps = "IBLOCK_PROPERTY_UNIT_PRODUCT" . "_" . $prop; $productUnitProps = $$productUnitProps; if (is_array($productUnitProps)) { @@ -51,7 +51,7 @@ foreach ($iblockProperties as $prop) { $IBLOCK_PROPERTY_UNIT_PRODUCT[$iblock][$prop] = $val; } } - + $productProps = "IBLOCK_PROPERTY_PRODUCT" . "_" . $prop; $productProps = $$productProps; if (is_array($productProps)) { @@ -70,4 +70,5 @@ $loader->propertiesProduct = $IBLOCK_PROPERTY_PRODUCT; $loader->propertiesUnitProduct = $IBLOCK_PROPERTY_UNIT_PRODUCT; $loader->filename = $SETUP_FILE_NAME; $loader->application = $APPLICATION; +$loader->loadPurchasePrice = $LOAD_PURCHASE_PRICE == 'Y'; $loader->Load(); \ No newline at end of file diff --git a/intaro.intarocrm/export/export_setup.php b/intaro.intarocrm/export/export_setup.php index c939ddb3..f4c666a5 100644 --- a/intaro.intarocrm/export/export_setup.php +++ b/intaro.intarocrm/export/export_setup.php @@ -20,6 +20,8 @@ if (($ACTION == 'EXPORT' || $ACTION == 'EXPORT_EDIT' || $ACTION == 'EXPORT_COPY' if (isset($arOldSetupVars['SETUP_FILE_NAME'])) $SETUP_FILE_NAME = $arOldSetupVars['SETUP_FILE_NAME']; + if (isset($arOldSetupVars['LOAD_PURCHASE_PRICE'])) + $LOAD_PURCHASE_PRICE = $arOldSetupVars['LOAD_PURCHASE_PRICE']; if (isset($arOldSetupVars['SETUP_PROFILE_NAME'])) $SETUP_PROFILE_NAME = $arOldSetupVars['SETUP_PROFILE_NAME']; if (isset($arOldSetupVars['IBLOCK_EXPORT'])) @@ -35,8 +37,8 @@ if (($ACTION == 'EXPORT' || $ACTION == 'EXPORT_EDIT' || $ACTION == 'EXPORT_COPY' $IBLOCK_PROPERTY_UNIT_SKU[$iblock][$prop] = $val; } } - - + + $IBLOCK_PROPERTY_PRODUCT = array(); $IBLOCK_PROPERTY_UNIT_PRODUCT = array(); foreach ($iblockProperties as $prop) { @@ -96,7 +98,7 @@ if ($STEP==1) ?> - +



GetMessage("PROPERTY_ARTICLE_HEADER_NAME"), "manufacturer" => GetMessage("PROPERTY_MANUFACTURER_HEADER_NAME"), @@ -115,15 +117,15 @@ if ($STEP==1) "width" => GetMessage("PROPERTY_WIDTH_HEADER_NAME"), "height" => GetMessage("PROPERTY_HEIGHT_HEADER_NAME"), ); - + $iblockFieldsName = Array( - + "weight" => Array("code" => "catalog_size" , "name" => GetMessage("SELECT_WEIGHT_PROPERTY_NAME"), 'unit' => 'mass'), "length" => Array("code" => "catalog_length" , "name" => GetMessage("SELECT_LENGTH_PROPERTY_NAME"), 'unit' => 'length'), "width" => Array("code" => "catalog_width" , "name" => GetMessage("SELECT_WIDTH_PROPERTY_NAME"), 'unit' => 'length'), "height" => Array("code" => "catalog_height" , "name" => GetMessage("SELECT_HEIGHT_PROPERTY_NAME"), 'unit' => 'length'), ); - + $iblockPropertiesHint = Array( "article" => Array("ARTICLE", "ART", "ARTNUMBER", "ARTICUL", "ARTIKUL"), "manufacturer" => Array("MANUFACTURER", "PROISVODITEL", "PROISVOD", "PROISV"), @@ -134,7 +136,7 @@ if ($STEP==1) "width" => Array("WIDTH", "SHIRINA"), "height" => Array("HEIGHT", "VISOTA"), ); - + $units = Array( 'length' => Array( 'mm' => GetMessage("UNIT_MEASUREMENT_MM"), @@ -147,18 +149,18 @@ if ($STEP==1) 'kg' => GetMessage("UNIT_MEASUREMENT_KG"), ) ); - + $hintUnit = Array( 'length' => 'mm', 'mass' => 'g' ); - + $boolAll = false; $intCountChecked = 0; $intCountAvailIBlock = 0; $arIBlockList = array(); $db_res = CIBlock::GetList(Array("IBLOCK_TYPE"=>"ASC", "NAME"=>"ASC"),array('CHECK_PERMISSIONS' => 'Y','MIN_PERMISSION' => 'W')); - + while ($iblock = $db_res->Fetch()) { if ($arCatalog = CCatalog::GetByIDExt($iblock["ID"])) @@ -169,46 +171,46 @@ if ($STEP==1) if ($arCatalog['CATALOG_TYPE'] == "X" || $arCatalog['CATALOG_TYPE'] == "P") { $iblockOffer = CCatalogSKU::GetInfoByProductIBlock($iblock["ID"]); - + $db_properties = CIBlock::GetProperties($iblockOffer['IBLOCK_ID'], Array()); while($prop = $db_properties->Fetch()) $propertiesSKU[] = $prop; - + $oldPropertySKU = null; if (isset($IBLOCK_PROPERTY_SKU[$iblock['ID']])) { foreach ($iblockPropertiesName as $key => $prop) { $oldPropertySKU[$key] = $IBLOCK_PROPERTY_SKU[$iblock['ID']][$key]; } } - + $oldPropertyUnitSKU = null; if (isset($IBLOCK_PROPERTY_UNIT_SKU[$iblock['ID']])) { foreach ($iblockPropertiesName as $key => $prop) { $oldPropertyUnitSKU[$key] = $IBLOCK_PROPERTY_UNIT_SKU[$iblock['ID']][$key]; } } - } - - + } + + $propertiesProduct = null; $db_properties = CIBlock::GetProperties($iblock['ID'], Array()); while($prop = $db_properties->Fetch()) $propertiesProduct[] = $prop; - + $oldPropertyProduct = null; if (isset($IBLOCK_PROPERTY_PRODUCT[$iblock['ID']])) { foreach ($iblockPropertiesName as $key => $prop) { $oldPropertyProduct[$key] = $IBLOCK_PROPERTY_PRODUCT[$iblock['ID']][$key]; } } - + $oldPropertyUnitProduct = null; if (isset($IBLOCK_PROPERTY_UNIT_PRODUCT[$iblock['ID']])) { foreach ($iblockPropertiesName as $key => $prop) { $oldPropertyUnitProduct[$key] = $IBLOCK_PROPERTY_UNIT_PRODUCT[$iblock['ID']][$key]; } } - + $arSiteList = array(); $rsSites = CIBlock::GetSite($iblock["ID"]); while ($arSite = $rsSites->Fetch()) @@ -220,7 +222,7 @@ if ($STEP==1) $boolExport = (in_array($iblock['ID'], $IBLOCK_EXPORT)); else $boolExport = true; - + $arIBlockList[] = array( 'ID' => $iblock['ID'], @@ -253,12 +255,12 @@ if ($STEP==1) ?> - >
@@ -283,7 +285,7 @@ if ($STEP==1) > - - + $property): ?> - + - + - + - + - +
+
@@ -297,16 +299,16 @@ if ($STEP==1)
- + - +
@@ -518,8 +520,8 @@ if ($STEP==1)
- - + + @@ -527,7 +529,7 @@ if ($STEP==1)

- +

+
+
+ +   + >

@@ -562,7 +569,7 @@ if ($STEP==1) function checkAll(obj,cnt) { for (i = 0; i < cnt; i++) - { + { if (obj.checked) BX.removeClass('IBLOCK_EXPORT_TABLE'+(i+1),"iblock-export-table-display-none"); } @@ -576,16 +583,16 @@ if ($STEP==1) transition : BX.easing.transitions.linear, step : function(state){ for (i = 0; i < cnt; i++) - { + { BX('IBLOCK_EXPORT_TABLE'+(i+1)).style.opacity = state.opacity/100; } }, complete : function() { for (i = 0; i < cnt; i++) - { + { if (!obj.checked) BX.addClass('IBLOCK_EXPORT_TABLE'+(i+1),"iblock-export-table-display-none"); - } + } } }); easing.animate(); @@ -611,7 +618,7 @@ if ($STEP==1) }, complete : function() { if (!obj.checked) - BX.addClass(table,"iblock-export-table-display-none"); + BX.addClass(table,"iblock-export-table-display-none"); } }); easing.animate(); @@ -637,14 +644,14 @@ if ($STEP==1) "> diff --git a/intaro.intarocrm/lang/ru/icml_export_setup.php b/intaro.intarocrm/lang/ru/icml_export_setup.php index 22becf48..76a3818f 100644 --- a/intaro.intarocrm/lang/ru/icml_export_setup.php +++ b/intaro.intarocrm/lang/ru/icml_export_setup.php @@ -5,6 +5,7 @@ $MESS["EXPORT_CATALOGS"] = "Выберите каталоги для выгру $MESS["CATALOG"] = "Каталог"; $MESS["EXPORT2INTAROCML"] = "Выгрузить в ICML"; $MESS["FILENAME"] = "Укажите имя файла данных:"; +$MESS["LOAD_PURCHASE_PRICE"] = "Выгружать закупочную цену"; $MESS["PROPERTY"] = "Свойство, содержащее артикул товара"; $MESS["ALL_CATALOG"] = "Все каталоги"; $MESS["CET_EXPORT"] = "Экспортировать";