diff --git a/CHANGELOG.md b/CHANGELOG.md index 5e91d63e..93bcec96 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,9 @@ +## 2018-06-33 v.2.3.7 +* Добавлена выгрузка штрихкодов в ICML +* Добавлена выгрузка картинок торговых предложений в ICML +* Улучшена передача типа доставки в заказе +* Добавлена проверка некоторых настроек при передаче заказа + ## 2018-05-23 v.2.3.6 * Улучшена выгрузка свойств товаров типа "справочник" * Добавлена настройка выгрузки габаритов и веса в заказе diff --git a/intaro.retailcrm/classes/general/history/RetailCrmHistory_v5.php b/intaro.retailcrm/classes/general/history/RetailCrmHistory_v5.php index bd7e3f1d..ca83a620 100644 --- a/intaro.retailcrm/classes/general/history/RetailCrmHistory_v5.php +++ b/intaro.retailcrm/classes/general/history/RetailCrmHistory_v5.php @@ -293,7 +293,10 @@ class RetailCrmHistory if (is_array($newResOrder) && !empty($newResOrder)) { $order = $newResOrder; } elseif ($newResOrder === false) { - RCrmActions::eventLog('RetailCrmHistory::orderHistory', 'retailCrmBeforeOrderSave()', 'OrderCrmId = ' . $order['id'] . '. Sending canceled after retailCrmBeforeOrderSave'); + RCrmActions::eventLog('RetailCrmHistory::orderHistory', + 'retailCrmBeforeOrderSave()', + 'OrderCrmId = ' . $order['id'] . '. Sending canceled after retailCrmBeforeOrderSave' + ); continue; } diff --git a/intaro.retailcrm/classes/general/icml/RetailCrmICML.php b/intaro.retailcrm/classes/general/icml/RetailCrmICML.php index 06b74bba..21edbf0d 100644 --- a/intaro.retailcrm/classes/general/icml/RetailCrmICML.php +++ b/intaro.retailcrm/classes/general/icml/RetailCrmICML.php @@ -253,6 +253,21 @@ class RetailCrmICML ); foreach ($this->iblocks as $key => $id) { + $barcodes = array(); + $dbBarCode = CCatalogStoreBarCode::getList( + array(), + array("IBLOCK_ID" => $id), + false, + false, + array('PRODUCT_ID', 'BARCODE') + ); + + while($arBarCode = $dbBarCode->GetNext()) { + if (!empty($arBarCode)) { + $barcodes[$arBarCode['PRODUCT_ID']] = $arBarCode['BARCODE']; + } + } + $highloadblockSkuProps = array(); $highloadblockProductProps = array(); @@ -366,9 +381,9 @@ class RetailCrmICML while ($file = $dbFiles->GetNext()) { // Link picture to product $products[$pictures[$file['ID']]]['PICTURE'] = $this->protocol . - $this->serverName . - '/upload/' . $file['SUBDIR'] . - '/' . $file['FILE_NAME'] ; + $this->serverName . + '/upload/' . $file['SUBDIR'] . + '/' . $file['FILE_NAME'] ; } unset($pictures); @@ -389,6 +404,7 @@ class RetailCrmICML while ($offer = $dbResOffers->GetNext()) { // Link offers to products + $offer['PICTURE'] = $this->protocol . $this->serverName . CFile::GetPath($offer["DETAIL_PICTURE"]); $products[$offer['PROPERTY_' . $iblockOffer['SKU_PROPERTY_ID'] . '_VALUE']]['offers'][$offer['ID']] = $offer; } unset($offer, $dbResOffers); @@ -437,13 +453,13 @@ class RetailCrmICML $categories[$catId] = $allCategories[$catId]; } - $existOffer = false; if (!empty($iblockOffer['IBLOCK_ID'])) { foreach ($product['offers'] as $offer) { + $offer['BARCODE'] = isset($barcodes[$offer['ID']]) ? $barcodes[$offer['ID']] : ''; $offer['PRODUCT_ID'] = $product["ID"]; $offer['DETAIL_PAGE_URL'] = $product["DETAIL_PAGE_URL"]; - $offer['PICTURE'] = $product["PICTURE"]; + $offer['PICTURE'] = $offer["PICTURE"] ? $offer["PICTURE"] : $product["PICTURE"]; $offer['PRODUCT_NAME'] = $product["NAME"]; $offer['PRODUCT_ACTIVE'] = $product["ACTIVE"]; $offer['PRICE'] = $offer['CATALOG_PRICE_' . $basePriceId]; @@ -484,6 +500,7 @@ class RetailCrmICML } } if (!$existOffer) { + $offer['BARCODE'] = isset($barcodes[$product["ID"]]) ? $barcodes[$product["ID"]] : ''; $product['PRODUCT_ID'] = $product["ID"]; $product['PRODUCT_NAME'] = $product["NAME"]; $product['PRODUCT_ACTIVE'] = $product["ACTIVE"]; @@ -499,7 +516,6 @@ class RetailCrmICML $stringOffers .= $this->BuildOffer($product, $categories, $iblock, $allCategories); } - } unset($products); @@ -589,6 +605,9 @@ class RetailCrmICML } } + if ($arOffer["BARCODE"]) { + $offer.= "" . $this->PrepareValue($arOffer["BARCODE"]) . "\n"; + } $offer.= "\n"; diff --git a/intaro.retailcrm/classes/general/order/RetailCrmOrder_v4.php b/intaro.retailcrm/classes/general/order/RetailCrmOrder_v4.php index e51246cc..bd232b0b 100644 --- a/intaro.retailcrm/classes/general/order/RetailCrmOrder_v4.php +++ b/intaro.retailcrm/classes/general/order/RetailCrmOrder_v4.php @@ -70,9 +70,13 @@ class RetailCrmOrder //fields foreach ($arFields['PROPS']['properties'] as $prop) { - if ($search = array_search($prop['CODE'], $arParams['optionsLegalDetails'][$arFields['PERSON_TYPE_ID']])) { + if (!empty($arParams['optionsLegalDetails']) + && $search = array_search($prop['CODE'], $arParams['optionsLegalDetails'][$arFields['PERSON_TYPE_ID']]) + ) { $order['contragent'][$search] = $prop['VALUE'][0];//legal order data - } elseif ($search = array_search($prop['CODE'], $arParams['optionsCustomFields'][$arFields['PERSON_TYPE_ID']])) { + } elseif (!empty($arParams['optionsCustomFields']) + && $search = array_search($prop['CODE'], $arParams['optionsCustomFields'][$arFields['PERSON_TYPE_ID']]) + ) { $order['customFields'][$search] = $prop['VALUE'][0];//custom properties } elseif ($search = array_search($prop['CODE'], $arParams['optionsOrderProps'][$arFields['PERSON_TYPE_ID']])) {//other if (in_array($search, array('fio', 'phone', 'email'))) {//fio, phone, email @@ -340,6 +344,10 @@ class RetailCrmOrder $shipmentList = $obOrder->getShipmentCollection(); foreach ($shipmentList as $shipmentData) { + if ($shipmentData->isSystem()) { + continue; + } + if ($shipmentData->getDeliveryId()) { $delivery = \Bitrix\Sale\Delivery\Services\Manager::getById($shipmentData->getDeliveryId()); $siteDeliverys = RCrmActions::DeliveryList(); diff --git a/intaro.retailcrm/classes/general/order/RetailCrmOrder_v5.php b/intaro.retailcrm/classes/general/order/RetailCrmOrder_v5.php index 0be2fa7b..638b7c8e 100644 --- a/intaro.retailcrm/classes/general/order/RetailCrmOrder_v5.php +++ b/intaro.retailcrm/classes/general/order/RetailCrmOrder_v5.php @@ -74,9 +74,13 @@ class RetailCrmOrder //fields foreach ($arFields['PROPS']['properties'] as $prop) { - if ($search = array_search($prop['CODE'], $arParams['optionsLegalDetails'][$arFields['PERSON_TYPE_ID']])) { + if (!empty($arParams['optionsLegalDetails']) + && $search = array_search($prop['CODE'], $arParams['optionsLegalDetails'][$arFields['PERSON_TYPE_ID']]) + ) { $order['contragent'][$search] = $prop['VALUE'][0];//legal order data - } elseif ($search = array_search($prop['CODE'], $arParams['optionsCustomFields'][$arFields['PERSON_TYPE_ID']])) { + } elseif (!empty($arParams['optionsCustomFields']) + && $search = array_search($prop['CODE'], $arParams['optionsCustomFields'][$arFields['PERSON_TYPE_ID']]) + ) { $order['customFields'][$search] = $prop['VALUE'][0];//custom properties } elseif ($search = array_search($prop['CODE'], $arParams['optionsOrderProps'][$arFields['PERSON_TYPE_ID']])) {//other if (in_array($search, array('fio', 'phone', 'email'))) {//fio, phone, email @@ -389,6 +393,10 @@ class RetailCrmOrder $shipmentList = $obOrder->getShipmentCollection(); foreach ($shipmentList as $shipmentData) { + if ($shipmentData->isSystem()) { + continue; + } + if ($shipmentData->getDeliveryId()) { $delivery = \Bitrix\Sale\Delivery\Services\Manager::getById($shipmentData->getDeliveryId()); $siteDeliverys = RCrmActions::DeliveryList(); diff --git a/intaro.retailcrm/description.ru b/intaro.retailcrm/description.ru index 8fda3eeb..d9910681 100644 --- a/intaro.retailcrm/description.ru +++ b/intaro.retailcrm/description.ru @@ -1,6 +1,4 @@ -- Улучшена выгрузка свойств товаров типа "справочник" -- Добавлена настройка выгрузки габаритов и веса в заказе -- Добавлена совместимость натройки экспорта для Google Chrome -- Исправлена ошибка при выгрузке истории с пустым городом -- Добавлены проверки на существование модуля Highloadblock -- Исправлен баг с отправкой пустого заказа при удалении в 1С-Битрикс +- Добавлена выгрузка штрихкодов в ICML +- Добавлена выгрузка картинок торговых предложений в ICML +- Улучшена передача типа доставки в заказе +- Добавлена проверка некоторых настроек при передаче заказа diff --git a/intaro.retailcrm/install/version.php b/intaro.retailcrm/install/version.php index f8dc1101..b200bf2b 100644 --- a/intaro.retailcrm/install/version.php +++ b/intaro.retailcrm/install/version.php @@ -1,5 +1,5 @@ "2.3.6", - "VERSION_DATE" => "2018-05-23 13:15:00" + "VERSION" => "2.3.7", + "VERSION_DATE" => "2018-06-13 13:15:00" );