From b1a71726fc02b445a8bc364ab78b033111e5068f Mon Sep 17 00:00:00 2001 From: "m.korolev" Date: Tue, 20 Aug 2013 13:42:13 +0400 Subject: [PATCH] Articles is not modatory now --- .../classes/general/ICMLLoader.php | 23 ++++++++++++------- intaro.intarocrm/export/export_setup.php | 6 ++--- .../install/export/intarocrm_run.php | 2 +- .../install/export/intarocrm_setup.php | 2 +- intaro.intarocrm/install/index.php | 4 +++- .../lang/ru/icml_export_setup.php | 2 +- 6 files changed, 24 insertions(+), 15 deletions(-) diff --git a/intaro.intarocrm/classes/general/ICMLLoader.php b/intaro.intarocrm/classes/general/ICMLLoader.php index 11ff286b..fa9a725a 100644 --- a/intaro.intarocrm/classes/general/ICMLLoader.php +++ b/intaro.intarocrm/classes/general/ICMLLoader.php @@ -17,7 +17,7 @@ class ICMLLoader { if(!isset($USER)) $USER = new CUser; - if (count($this->iblocks) != count($this->articleProperties)) + if (count($this->iblocks) < count($this->articleProperties)) return false; $categories = $this->GetCategories(); @@ -164,9 +164,12 @@ class ICMLLoader { "DETAIL_TEXT", "DETAIL_PICTURE", "LANG_DIR", - "DETAIL_PAGE_URL", - "PROPERTY_" . $this->articleProperties[$id] + "DETAIL_PAGE_URL" ); + + if (isset($this->articleProperties[$id])) + $arSelect[] = "PROPERTY_" . $this->articleProperties[$id]; + $filter = Array ( "IBLOCK_ID" => $id, @@ -194,9 +197,10 @@ class ICMLLoader { "NAME", "DETAIL_TEXT", "DETAIL_PAGE_URL", - "DETAIL_PICTURE", - "PROPERTY_" . $this->articleProperties[$id] + "DETAIL_PICTURE" ); + if (isset($this->articleProperties[$id])) + $arSelectOffer[] = "PROPERTY_" . $this->articleProperties[$id]; $rsOffers = CIBlockElement::GetList(array(), $arFilterOffer, false, false, $arSelectOffer); while ($arOffer = $rsOffers->GetNext()) { @@ -215,7 +219,8 @@ class ICMLLoader { $arOffer['DETAIL_PICTURE'] = $product["DETAIL_PICTURE"]; $arOffer['PREVIEW_PICTURE'] = $product["PREVIEW_PICTURE"]; $arOffer['PRODUCT_NAME'] = $product["NAME"]; - $arOffer['ARTICLE'] = $arOffer["PROPERTY_" . $this->articleProperties[$id] . "_VALUE"]; + if (isset($this->articleProperties[$id])) + $arOffer['ARTICLE'] = $arOffer["PROPERTY_" . $this->articleProperties[$id] . "_VALUE"]; $dbPrice = GetCatalogProductPrice($arOffer["ID"],1); $arOffer['PRICE'] = $dbPrice['PRICE']; @@ -239,7 +244,8 @@ class ICMLLoader { $product['PRODUCT_ID'] = $product["ID"]; $product['PRODUCT_NAME'] = $product["NAME"]; - $product['ARTICLE'] = $product["PROPERTY_" . $this->articleProperties[$id] . "_VALUE"]; + if (isset($this->articleProperties[$id])) + $product['ARTICLE'] = $product["PROPERTY_" . $this->articleProperties[$id] . "_VALUE"]; $dbPrice = GetCatalogProductPrice($product["ID"],1); $product['PRICE'] = $dbPrice['PRICE']; @@ -289,7 +295,8 @@ class ICMLLoader { $offer .= "" . $this->PrepareValue($arOffer["EXTERNAL_ID"]) . "\n"; $offer .= "" . $this->PrepareValue($arOffer["PRODUCT_NAME"]) . "\n"; - $offer .= "
" . $this->PrepareValue($arOffer["ARTICLE"]) . "
\n"; + if (isset($arOffer["ARTICLE"])) + $offer .= "
" . $this->PrepareValue($arOffer["ARTICLE"]) . "
\n"; $offer.= "\n"; return $offer; diff --git a/intaro.intarocrm/export/export_setup.php b/intaro.intarocrm/export/export_setup.php index 40925907..f7a68eb7 100644 --- a/intaro.intarocrm/export/export_setup.php +++ b/intaro.intarocrm/export/export_setup.php @@ -22,7 +22,7 @@ if ($STEP>1) { - if (count($IBLOCK_EXPORT) != count($IBLOCK_PROPERTY_ARTICLE)) + if (count($IBLOCK_EXPORT) < count($IBLOCK_PROPERTY_ARTICLE)) $arSetupErrors[] = GetMessage("ERROR_ARTICLE_NOT_SET"); if (strlen($SETUP_FILE_NAME)<=0) @@ -159,8 +159,8 @@ if ($STEP==1) ]" + id="IBLOCK_EXPORT" value="" onclick="checkOne(this,);" diff --git a/intaro.intarocrm/install/export/intarocrm_run.php b/intaro.intarocrm/install/export/intarocrm_run.php index 5d73dc38..35313159 100644 --- a/intaro.intarocrm/install/export/intarocrm_run.php +++ b/intaro.intarocrm/install/export/intarocrm_run.php @@ -1,3 +1,3 @@ IntaroCRM -require($_SERVER["DOCUMENT_ROOT"]."/bitrix/intaro.intarocrm/export/load/export_run.php"); \ No newline at end of file +require($_SERVER["DOCUMENT_ROOT"]."/bitrix/modules/intaro.intarocrm/export/export_run.php"); \ No newline at end of file diff --git a/intaro.intarocrm/install/export/intarocrm_setup.php b/intaro.intarocrm/install/export/intarocrm_setup.php index b9feee9f..b2297fb0 100644 --- a/intaro.intarocrm/install/export/intarocrm_setup.php +++ b/intaro.intarocrm/install/export/intarocrm_setup.php @@ -1,3 +1,3 @@ IntaroCRM -require($_SERVER["DOCUMENT_ROOT"]."/bitrix/intaro.intarocrm/export/load/export_setup.php"); \ No newline at end of file +require($_SERVER["DOCUMENT_ROOT"]."/bitrix/modules/intaro.intarocrm/export/export_setup.php"); \ No newline at end of file diff --git a/intaro.intarocrm/install/index.php b/intaro.intarocrm/install/index.php index 9d061bf0..a36d588c 100755 --- a/intaro.intarocrm/install/index.php +++ b/intaro.intarocrm/install/index.php @@ -677,7 +677,7 @@ class intaro_intarocrm extends CModule else $filename = $_POST['SETUP_FILE_NAME']; - if (count($iblocks) != count($articleProperties)) + if (count($iblocks) < count($articleProperties)) $arResult['errCode'] = 'ERR_ARTICLE_IBLOCK'; @@ -694,6 +694,8 @@ class intaro_intarocrm extends CModule if ($typeLoading != 'none' && $profileName == "") $arResult['errCode'] = 'ERR_FIELDS_PROFILE'; + if($filename == "") + $arResult['errCode'] = 'ERR_FIELDS_FILE'; if(isset($arResult['errCode']) && $arResult['errCode']) { diff --git a/intaro.intarocrm/lang/ru/icml_export_setup.php b/intaro.intarocrm/lang/ru/icml_export_setup.php index 7f93c1af..98befe17 100644 --- a/intaro.intarocrm/lang/ru/icml_export_setup.php +++ b/intaro.intarocrm/lang/ru/icml_export_setup.php @@ -12,6 +12,6 @@ $MESS["CET_SAVE"] = "Сохранить"; $MESS["ERROR_IBLOCK_MODULE"] = "Модуль Инфоблоки не установлен"; $MESS["ERROR_IBLOCK_CATALOG"] = "Модуль Каталог не установлен"; $MESS["ERROR_IBLOCK_INTAROCRM"] = "Модуль IntaroCRM не установлен"; -$MESS["ERROR_ARTICLE_NOT_SET"] = "Не установлены поля артикулов"; +$MESS["ERROR_ARTICLE_NOT_SET"] = "Были установлены поля артикулов, но не установлены Информационные блоки"; ?> \ No newline at end of file