1
0
mirror of synced 2024-11-25 14:56:09 +03:00

Merge pull request #56 from iyzoer/master

v2.4.2
This commit is contained in:
Alex Lushpai 2018-12-26 11:56:23 +03:00 committed by GitHub
commit 6f6fb032e7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
13 changed files with 188 additions and 93 deletions

View File

@ -1,5 +1,11 @@
## 2018-12-26 v.2.4.2
* Добавлена конвертация закупочной цены при выгрузке заказа
* Исправлен файл переводов для выгрузки каталога
* В настройку экспорта каталога добавлена настройка максимального количества торговых предложений у товара
* Исправлен вызов обработчика сохранения оплаты при создании заказа
## 2018-11-02 v.2.4.1 ## 2018-11-02 v.2.4.1
* исправлены ошибки в файле optoins.php * Исправлены ошибки в файле options.php
## 2018-11-02 v.2.4.0 ## 2018-11-02 v.2.4.0
* Изменена привязка на событие сохранения заказа. Используется привязка к событию "OnSaleOrderSaved" * Изменена привязка на событие сохранения заказа. Используется привязка к событию "OnSaleOrderSaved"

View File

@ -3,6 +3,7 @@
* RCrmEvent * RCrmEvent
*/ */
use \Bitrix\Main\Event; use \Bitrix\Main\Event;
class RetailCrmEvent class RetailCrmEvent
{ {
protected static $MODULE_ID = 'intaro.retailcrm'; protected static $MODULE_ID = 'intaro.retailcrm';
@ -25,6 +26,8 @@ class RetailCrmEvent
* OnAfterUserUpdate * OnAfterUserUpdate
* *
* @param mixed $arFields - User arFields * @param mixed $arFields - User arFields
*
* @return mixed
*/ */
function OnAfterUserUpdate($arFields) function OnAfterUserUpdate($arFields)
{ {
@ -84,8 +87,9 @@ class RetailCrmEvent
* orderSave * orderSave
* *
* @param object $event - Order object * @param object $event - Order object
*
* @return bool
*/ */
function orderSave($event) function orderSave($event)
{ {
if ($GLOBALS['RETAILCRM_ORDER_OLD_EVENT'] !== false && $GLOBALS['RETAIL_CRM_HISTORY'] !== true && $GLOBALS['RETAILCRM_ORDER_DELETE'] !== true) { if ($GLOBALS['RETAILCRM_ORDER_OLD_EVENT'] !== false && $GLOBALS['RETAIL_CRM_HISTORY'] !== true && $GLOBALS['RETAILCRM_ORDER_DELETE'] !== true) {
@ -199,13 +203,19 @@ class RetailCrmEvent
/** /**
* paymentSave * paymentSave
* *
* @param object $event - Payment object * @param \Bitrix\Sale\Payment $event - Payment object
*/ */
function paymentSave($event) function paymentSave($event)
{ {
$apiVersion = COption::GetOptionString(self::$MODULE_ID, 'api_version', 0); $apiVersion = COption::GetOptionString(self::$MODULE_ID, 'api_version', 0);
if ((isset($GLOBALS['RETAIL_CRM_HISTORY']) && $GLOBALS['RETAIL_CRM_HISTORY']) || $apiVersion != 'v5') { /** @var \Bitrix\Sale\Order $order */
$order = $event->getCollection()->getOrder();
if ((isset($GLOBALS['RETAIL_CRM_HISTORY']) && $GLOBALS['RETAIL_CRM_HISTORY'])
|| $apiVersion != 'v5'
|| $order->isNew()
) {
return; return;
} }
@ -219,18 +229,10 @@ class RetailCrmEvent
'PAID' => $event->getField('PAID'), 'PAID' => $event->getField('PAID'),
'PAY_SYSTEM_ID' => $event->getField('PAY_SYSTEM_ID'), 'PAY_SYSTEM_ID' => $event->getField('PAY_SYSTEM_ID'),
'SUM' => $event->getField('SUM'), 'SUM' => $event->getField('SUM'),
'LID' => $event->getField('LID'), 'LID' => $order->getSiteId(),
'DATE_PAID' => $event->getField('DATE_PAID'), 'DATE_PAID' => $event->getField('DATE_PAID'),
); );
try {
$newOrder = Bitrix\Sale\Order::load($arPayment['ORDER_ID']);
$arPayment['LID'] = $newOrder->getField('LID');
} catch (Bitrix\Main\ArgumentNullException $e) {
RCrmActions::eventLog('RetailCrmEvent::paymentSave', 'Bitrix\Sale\Order::load', $e->getMessage() . ': ' . $arPayment['ORDER_ID']);
return;
}
if ($optionsSitesList) { if ($optionsSitesList) {
if (array_key_exists($arPayment['LID'], $optionsSitesList) && $optionsSitesList[$arPayment['LID']] !== null) { if (array_key_exists($arPayment['LID'], $optionsSitesList) && $optionsSitesList[$arPayment['LID']] !== null) {
$site = $optionsSitesList[$arPayment['LID']]; $site = $optionsSitesList[$arPayment['LID']];
@ -304,12 +306,14 @@ class RetailCrmEvent
* *
* @param object $event - Payment object * @param object $event - Payment object
*/ */
function paymentDelete($event) function paymentDelete($event)
{ {
$apiVersion = COption::GetOptionString(self::$MODULE_ID, 'api_version', 0); $apiVersion = COption::GetOptionString(self::$MODULE_ID, 'api_version', 0);
if ((isset($GLOBALS['RETAIL_CRM_HISTORY']) && $GLOBALS['RETAIL_CRM_HISTORY']) || $apiVersion != 'v5' || !$event->getId()) { if ((isset($GLOBALS['RETAIL_CRM_HISTORY']) && $GLOBALS['RETAIL_CRM_HISTORY'])
|| $apiVersion != 'v5'
|| !$event->getId()
) {
return; return;
} }
@ -317,17 +321,10 @@ class RetailCrmEvent
$arPayment = array( $arPayment = array(
'ID' => $event->getId(), 'ID' => $event->getId(),
'ORDER_ID' => $event->getField('ORDER_ID') 'ORDER_ID' => $event->getField('ORDER_ID'),
'LID' => $event->getCollection()->getOrder()->getSiteId()
); );
try {
$newOrder = Bitrix\Sale\Order::load($arPayment['ORDER_ID']);
$arPayment['LID'] = $newOrder->getField('LID');
} catch (Bitrix\Main\ArgumentNullException $e) {
RCrmActions::eventLog('RetailCrmEvent::paymentDelete', 'Bitrix\Sale\Order::load', $e->getMessage() . ': ' . $arPayment['ORDER_ID']);
return;
}
if ($optionsSitesList) { if ($optionsSitesList) {
if (array_key_exists($arPayment['LID'], $optionsSitesList) && $optionsSitesList[$arPayment['LID']] !== null) { if (array_key_exists($arPayment['LID'], $optionsSitesList) && $optionsSitesList[$arPayment['LID']] !== null) {
$site = $optionsSitesList[$arPayment['LID']]; $site = $optionsSitesList[$arPayment['LID']];

View File

@ -23,11 +23,11 @@ class RetailCrmICML
public $loadPurchasePrice = false; public $loadPurchasePrice = false;
public $productPictures; public $productPictures;
public $skuPictures; public $skuPictures;
public $offerPageSize = 50;
protected $fp; protected $fp;
protected $mainSection = 1000000; protected $mainSection = 1000000;
protected $pageSize = 500; protected $pageSize = 500;
protected $offerPageSize = 50;
protected $protocol; protected $protocol;
protected $isLogged = false; protected $isLogged = false;
@ -111,6 +111,17 @@ class RetailCrmICML
} }
private function setSiteAddress($block_id)
{
$site = CAllIBlock::GetSite($block_id)->Fetch();
if ($site['SERVER_NAME']) {
$this->serverName = $site['SERVER_NAME'];
} else {
$this->serverName = $this->defaultServerName;
}
}
protected function PrepareSettings() protected function PrepareSettings()
{ {
foreach ($this->propertiesSKU as $iblock => $arr) { foreach ($this->propertiesSKU as $iblock => $arr) {
@ -118,6 +129,7 @@ class RetailCrmICML
$this->propertiesSKU[$iblock][$id] = strtoupper($sku); $this->propertiesSKU[$iblock][$id] = strtoupper($sku);
} }
} }
foreach ($this->propertiesProduct as $iblock => $arr) { foreach ($this->propertiesProduct as $iblock => $arr) {
foreach ($arr as $id => $prod) { foreach ($arr as $id => $prod) {
$this->propertiesProduct[$iblock][$id] = strtoupper($prod); $this->propertiesProduct[$iblock][$id] = strtoupper($prod);
@ -202,22 +214,27 @@ class RetailCrmICML
{ {
$categories = array(); $categories = array();
foreach ($this->iblocks as $id) { foreach ($this->iblocks as $id) {
$this->setSiteAddress($id);
$filter = array("IBLOCK_ID" => $id); $filter = array("IBLOCK_ID" => $id);
$dbRes = CIBlockSection::GetList(array("left_margin" => "asc"), $filter); $dbRes = CIBlockSection::GetList(array("left_margin" => "asc"), $filter);
$hasCategories = false; $hasCategories = false;
while ($arRes = $dbRes->Fetch()) { while ($arRes = $dbRes->Fetch()) {
$categories[$arRes['ID']] = $arRes; $categories[$arRes['ID']] = $arRes;
$categories[$arRes['ID']]['SITE'] = $this->protocol . $this->serverName;
$hasCategories = true; $hasCategories = true;
} }
if (!$hasCategories) { if (!$hasCategories) {
$iblock = CIBlock::GetByID($id)->Fetch(); $iblock = CIBlock::GetByID($id)->Fetch();
$arRes = Array(); $arRes = array();
$arRes['ID'] = $this->mainSection + $id; $arRes['ID'] = $this->mainSection + $id;
$arRes['IBLOCK_SECTION_ID'] = 0; $arRes['IBLOCK_SECTION_ID'] = 0;
$arRes['NAME'] = sprintf(GetMessage('ROOT_CATEGORY_FOR_CATALOG'), $iblock['NAME']); $arRes['NAME'] = sprintf(GetMessage('ROOT_CATEGORY_FOR_CATALOG'), $iblock['NAME']);
$categories[$arRes['ID']] = $arRes; $categories[$arRes['ID']] = $arRes;
$categories[$arRes['ID']]['SITE'] = $this->protocol . $this->serverName;
} }
} }
@ -226,15 +243,25 @@ class RetailCrmICML
protected function BuildCategory($arCategory) protected function BuildCategory($arCategory)
{ {
return " $category =
<category id=\"" . $this->PrepareValue($arCategory["ID"]) . "\"" "<category id=\"" . $this->PrepareValue($arCategory["ID"]) . "\""
. ( intval($arCategory["IBLOCK_SECTION_ID"] ) > 0 ? . (intval($arCategory["IBLOCK_SECTION_ID"]) > 0 ?
" parentId=\"" . $this->PrepareValue($arCategory["IBLOCK_SECTION_ID"]) . "\"" " parentId=\"" . $this->PrepareValue($arCategory["IBLOCK_SECTION_ID"]) . "\""
:"") :"")
. ">" . ">\n\t"
. $this->PrepareValue($arCategory["NAME"]) . "<name>" . $this->PrepareValue($arCategory["NAME"]) . "</name>\n";
. "</category>\n";
if (CFile::GetPath($arCategory["DETAIL_PICTURE"])) {
$category .= "\t<picture>" . $arCategory['SITE'] . CFile::GetPath($arCategory["DETAIL_PICTURE"]) . "</picture>\n";
}
if (CFile::GetPath($arCategory["PICTURE"])) {
$category .= "\t<picture>" . $arCategory['SITE'] . CFile::GetPath($arCategory["PICTURE"]) . "</picture>\n";
}
$category .= "</category>\n";
return $category;
} }
protected function BuildOffers(&$allCategories) protected function BuildOffers(&$allCategories)
@ -246,14 +273,7 @@ class RetailCrmICML
); );
foreach ($this->iblocks as $key => $id) { foreach ($this->iblocks as $key => $id) {
$site = CAllIBlock::GetSite($id)->Fetch(); $this->setSiteAddress($id);
if ($site['SERVER_NAME']) {
$this->serverName = $site['SERVER_NAME'];
} else {
$this->serverName = $this->defaultServerName;
}
$barcodes = array(); $barcodes = array();
$dbBarCode = CCatalogStoreBarCode::getList( $dbBarCode = CCatalogStoreBarCode::getList(

View File

@ -20,6 +20,7 @@ class RetailCrmOrder
public static $CRM_ORDER_HISTORY_DATE = 'order_history_date'; public static $CRM_ORDER_HISTORY_DATE = 'order_history_date';
public static $CRM_CATALOG_BASE_PRICE = 'catalog_base_price'; public static $CRM_CATALOG_BASE_PRICE = 'catalog_base_price';
public static $CRM_ORDER_NUMBERS = 'order_numbers'; public static $CRM_ORDER_NUMBERS = 'order_numbers';
public static $CRM_CURRENCY = 'currency';
const CANCEL_PROPERTY_CODE = 'INTAROCRM_IS_CANCELED'; const CANCEL_PROPERTY_CODE = 'INTAROCRM_IS_CANCELED';
@ -44,6 +45,9 @@ class RetailCrmOrder
return false; return false;
} }
$optionsCurrency = COption::GetOptionString(self::$MODULE_ID, self::$CRM_CURRENCY, 0);
$currency = $optionsCurrency ? $optionsCurrency : \Bitrix\Currency\CurrencyManager::getBaseCurrency();
$order = array( $order = array(
'number' => $arFields['NUMBER'], 'number' => $arFields['NUMBER'],
'externalId' => $arFields['ID'], 'externalId' => $arFields['ID'],
@ -137,7 +141,17 @@ class RetailCrmOrder
$pp = CCatalogProduct::GetByID($product['PRODUCT_ID']); $pp = CCatalogProduct::GetByID($product['PRODUCT_ID']);
if (is_null($pp['PURCHASING_PRICE']) == false) { if (is_null($pp['PURCHASING_PRICE']) == false) {
$item['purchasePrice'] = $pp['PURCHASING_PRICE']; if ($pp['PURCHASING_CURRENCY'] && $currency != $pp['PURCHASING_CURRENCY']) {
$purchasePrice = CCurrencyRates::ConvertCurrency(
(double) $pp['PURCHASING_PRICE'],
$pp['PURCHASING_CURRENCY'],
$currency
);
} else {
$purchasePrice = $pp['PURCHASING_PRICE'];
}
$item['purchasePrice'] = $purchasePrice;
} }
$item['discount'] = (double) $product['DISCOUNT_PRICE']; $item['discount'] = (double) $product['DISCOUNT_PRICE'];
$item['discountPercent'] = 0; $item['discountPercent'] = 0;

View File

@ -21,6 +21,7 @@ class RetailCrmOrder
public static $CRM_CATALOG_BASE_PRICE = 'catalog_base_price'; public static $CRM_CATALOG_BASE_PRICE = 'catalog_base_price';
public static $CRM_ORDER_NUMBERS = 'order_numbers'; public static $CRM_ORDER_NUMBERS = 'order_numbers';
public static $CRM_ORDER_DIMENSIONS = 'order_dimensions'; public static $CRM_ORDER_DIMENSIONS = 'order_dimensions';
public static $CRM_CURRENCY = 'currency';
const CANCEL_PROPERTY_CODE = 'INTAROCRM_IS_CANCELED'; const CANCEL_PROPERTY_CODE = 'INTAROCRM_IS_CANCELED';
@ -46,6 +47,8 @@ class RetailCrmOrder
} }
$dimensionsSetting = COption::GetOptionString(self::$MODULE_ID, self::$CRM_ORDER_DIMENSIONS, 'N'); $dimensionsSetting = COption::GetOptionString(self::$MODULE_ID, self::$CRM_ORDER_DIMENSIONS, 'N');
$optionsCurrency = COption::GetOptionString(self::$MODULE_ID, self::$CRM_CURRENCY, 0);
$currency = $optionsCurrency ? $optionsCurrency : \Bitrix\Currency\CurrencyManager::getBaseCurrency();
$order = array( $order = array(
'number' => $arFields['NUMBER'], 'number' => $arFields['NUMBER'],
@ -146,7 +149,17 @@ class RetailCrmOrder
$pp = CCatalogProduct::GetByID($product['PRODUCT_ID']); $pp = CCatalogProduct::GetByID($product['PRODUCT_ID']);
if (is_null($pp['PURCHASING_PRICE']) == false) { if (is_null($pp['PURCHASING_PRICE']) == false) {
$item['purchasePrice'] = $pp['PURCHASING_PRICE']; if ($pp['PURCHASING_CURRENCY'] && $currency != $pp['PURCHASING_CURRENCY']) {
$purchasePrice = CCurrencyRates::ConvertCurrency(
(double) $pp['PURCHASING_PRICE'],
$pp['PURCHASING_CURRENCY'],
$currency
);
} else {
$purchasePrice = $pp['PURCHASING_PRICE'];
}
$item['purchasePrice'] = $purchasePrice;
} }
$discount = (double) $product['DISCOUNT_PRICE']; $discount = (double) $product['DISCOUNT_PRICE'];

View File

@ -1 +1,4 @@
- исправлены ошибки - Добавлена конвертация закупочной цены при выгрузке заказа
- Исправлен файл переводов для выгрузки каталога
- В настройку экспорта каталога добавлена настройка максимального количества торговых предложений у товара
- Исправлен вызов обработчика сохранения оплаты при создании заказа

View File

@ -144,6 +144,10 @@ if (file_exists($_SERVER["DOCUMENT_ROOT"]."/bitrix/php_interface/retailcrm/expor
$loader->highloadblockProductProperties = $IBLOCK_PROPERTY_PRODUCT_HIGHLOADBLOCK; $loader->highloadblockProductProperties = $IBLOCK_PROPERTY_PRODUCT_HIGHLOADBLOCK;
} }
if ($MAX_OFFERS_VALUE) {
$loader->offerPageSize = $MAX_OFFERS_VALUE;
}
$loader->filename = $SETUP_FILE_NAME; $loader->filename = $SETUP_FILE_NAME;
$loader->defaultServerName = $SERVER_NAME; $loader->defaultServerName = $SERVER_NAME;
$loader->application = $APPLICATION; $loader->application = $APPLICATION;

View File

@ -32,7 +32,7 @@ if (file_exists($_SERVER["DOCUMENT_ROOT"]."/bitrix/php_interface/retailcrm/expor
"picture" => "picture" "picture" => "picture"
); );
if(!check_bitrix_sessid()) { if (!check_bitrix_sessid()) {
return; return;
} }
@ -69,8 +69,7 @@ if (file_exists($_SERVER["DOCUMENT_ROOT"]."/bitrix/php_interface/retailcrm/expor
} }
} }
if (($ACTION == 'EXPORT' || $ACTION == 'EXPORT_EDIT' || $ACTION == 'EXPORT_COPY') && $STEP == 1) if (($ACTION == 'EXPORT' || $ACTION == 'EXPORT_EDIT' || $ACTION == 'EXPORT_COPY') && $STEP == 1) {
{
if (isset($arOldSetupVars['SETUP_FILE_NAME'])) if (isset($arOldSetupVars['SETUP_FILE_NAME']))
$SETUP_FILE_NAME = $arOldSetupVars['SETUP_FILE_NAME']; $SETUP_FILE_NAME = $arOldSetupVars['SETUP_FILE_NAME'];
if (isset($arOldSetupVars['LOAD_PURCHASE_PRICE'])) if (isset($arOldSetupVars['LOAD_PURCHASE_PRICE']))
@ -79,33 +78,32 @@ if (file_exists($_SERVER["DOCUMENT_ROOT"]."/bitrix/php_interface/retailcrm/expor
$SETUP_PROFILE_NAME = $arOldSetupVars['SETUP_PROFILE_NAME']; $SETUP_PROFILE_NAME = $arOldSetupVars['SETUP_PROFILE_NAME'];
if (isset($arOldSetupVars['IBLOCK_EXPORT'])) if (isset($arOldSetupVars['IBLOCK_EXPORT']))
$IBLOCK_EXPORT = $arOldSetupVars['IBLOCK_EXPORT']; $IBLOCK_EXPORT = $arOldSetupVars['IBLOCK_EXPORT'];
if (isset($arOldSetupVars['IBLOCK_EXPORT']))
$IBLOCK_PROPERTY_SKU = array(); $MAX_OFFERS_VALUE = $arOldSetupVars['MAX_OFFERS_VALUE'];
$IBLOCK_PROPERTY_UNIT_SKU = array(); $IBLOCK_PROPERTY_SKU = [];
$IBLOCK_PROPERTY_UNIT_SKU = [];
foreach ($iblockProperties as $prop) { foreach ($iblockProperties as $prop) {
foreach ($arOldSetupVars['IBLOCK_PROPERTY_SKU'. '_' . $prop] as $iblock => $val) { foreach ($arOldSetupVars['IBLOCK_PROPERTY_SKU' . '_' . $prop] as $iblock => $val) {
$IBLOCK_PROPERTY_SKU[$iblock][$prop] = $val; $IBLOCK_PROPERTY_SKU[$iblock][$prop] = $val;
} }
foreach ($arOldSetupVars['IBLOCK_PROPERTY_UNIT_SKU'. '_' . $prop] as $iblock => $val) { foreach ($arOldSetupVars['IBLOCK_PROPERTY_UNIT_SKU' . '_' . $prop] as $iblock => $val) {
$IBLOCK_PROPERTY_UNIT_SKU[$iblock][$prop] = $val; $IBLOCK_PROPERTY_UNIT_SKU[$iblock][$prop] = $val;
} }
} }
$IBLOCK_PROPERTY_PRODUCT = array(); $IBLOCK_PROPERTY_PRODUCT = [];
$IBLOCK_PROPERTY_UNIT_PRODUCT = array(); $IBLOCK_PROPERTY_UNIT_PRODUCT = [];
foreach ($iblockProperties as $prop) { foreach ($iblockProperties as $prop) {
foreach ($arOldSetupVars['IBLOCK_PROPERTY_PRODUCT'. '_' . $prop] as $iblock => $val) { foreach ($arOldSetupVars['IBLOCK_PROPERTY_PRODUCT' . '_' . $prop] as $iblock => $val) {
$IBLOCK_PROPERTY_PRODUCT[$iblock][$prop] = $val; $IBLOCK_PROPERTY_PRODUCT[$iblock][$prop] = $val;
} }
foreach ($arOldSetupVars['IBLOCK_PROPERTY_UNIT_PRODUCT'. '_' . $prop] as $iblock => $val) { foreach ($arOldSetupVars['IBLOCK_PROPERTY_UNIT_PRODUCT' . '_' . $prop] as $iblock => $val) {
$IBLOCK_PROPERTY_UNIT_PRODUCT[$iblock][$prop] = $val; $IBLOCK_PROPERTY_UNIT_PRODUCT[$iblock][$prop] = $val;
} }
} }
} }
if ($STEP > 1)
if ($STEP>1)
{ {
if (strlen($SETUP_FILE_NAME)<=0) if (strlen($SETUP_FILE_NAME)<=0)
@ -647,6 +645,18 @@ if (file_exists($_SERVER["DOCUMENT_ROOT"]."/bitrix/php_interface/retailcrm/expor
<br> <br>
<br> <br>
<?if ($ACTION=="EXPORT_SETUP" || $ACTION == 'EXPORT_EDIT' || $ACTION == 'EXPORT_COPY'):?>
<font class="text"><?=GetMessage("OFFERS_VALUE");?><br><br></font>
<input
type="text"
name="MAX_OFFERS_VALUE"
value="<?echo htmlspecialchars($MAX_OFFERS_VALUE)?>"
size="15">
<br>
<br>
<br>
<?endif;?>
<?if ($ACTION=="EXPORT_SETUP" || $ACTION == 'EXPORT_EDIT' || $ACTION == 'EXPORT_COPY'):?> <?if ($ACTION=="EXPORT_SETUP" || $ACTION == 'EXPORT_EDIT' || $ACTION == 'EXPORT_COPY'):?>
<font class="text"><?=GetMessage("PROFILE_NAME");?><br><br></font> <font class="text"><?=GetMessage("PROFILE_NAME");?><br><br></font>
<input <input
@ -790,7 +800,7 @@ if (file_exists($_SERVER["DOCUMENT_ROOT"]."/bitrix/php_interface/retailcrm/expor
<?=bitrix_sessid_post();?> <?=bitrix_sessid_post();?>
<? <?
$vals = "LOAD_PURCHASE_PRICE,SETUP_FILE_NAME,IBLOCK_EXPORT"; $vals = "LOAD_PURCHASE_PRICE,SETUP_FILE_NAME,IBLOCK_EXPORT,MAX_OFFERS_VALUE";
foreach ($iblockProperties as $val) { foreach ($iblockProperties as $val) {
$vals .= ",IBLOCK_PROPERTY_SKU_" . $val; $vals .= ",IBLOCK_PROPERTY_SKU_" . $val;
$vals .= ",IBLOCK_PROPERTY_UNIT_SKU_" . $val; $vals .= ",IBLOCK_PROPERTY_UNIT_SKU_" . $val;
@ -820,7 +830,7 @@ if (file_exists($_SERVER["DOCUMENT_ROOT"]."/bitrix/php_interface/retailcrm/expor
<? <?
} }
elseif ($STEP==2) elseif ($STEP == 2)
{ {
COption::SetOptionString($MODULE_ID, $CRM_CATALOG_BASE_PRICE . '_' . $_REQUEST['PROFILE_ID'], htmlspecialchars(trim($_POST['price-types']))); COption::SetOptionString($MODULE_ID, $CRM_CATALOG_BASE_PRICE . '_' . $_REQUEST['PROFILE_ID'], htmlspecialchars(trim($_POST['price-types'])));
$FINITE = true; $FINITE = true;

View File

@ -864,6 +864,12 @@ class intaro_retailcrm extends CModule
$typeLoading = $_POST['TYPE_LOADING']; $typeLoading = $_POST['TYPE_LOADING'];
} }
if (!isset($_POST['MAX_OFFERS_VALUE'])) {
$maxOffers = "";
} else {
$maxOffers = $_POST['MAX_OFFERS_VALUE'];
}
if (!isset($_POST['SETUP_PROFILE_NAME'])) { if (!isset($_POST['SETUP_PROFILE_NAME'])) {
$profileName = ""; $profileName = "";
} else { } else {
@ -886,7 +892,8 @@ class intaro_retailcrm extends CModule
'IBLOCK_PROPERTY_PRODUCT' => $propertiesProduct, 'IBLOCK_PROPERTY_PRODUCT' => $propertiesProduct,
'IBLOCK_PROPERTY_UNIT_PRODUCT' => $propertiesUnitProduct, 'IBLOCK_PROPERTY_UNIT_PRODUCT' => $propertiesUnitProduct,
'SETUP_FILE_NAME' => $filename, 'SETUP_FILE_NAME' => $filename,
'SETUP_PROFILE_NAME' => $profileName 'SETUP_PROFILE_NAME' => $profileName,
'MAX_OFFERS_VALUE' => $maxOffers
); );
global $oldValues; global $oldValues;
$oldValues = $arOldValues; $oldValues = $arOldValues;
@ -938,6 +945,10 @@ class intaro_retailcrm extends CModule
$loader->highloadblockProductProperties = $propertiesHbProduct; $loader->highloadblockProductProperties = $propertiesHbProduct;
} }
if ($maxOffers) {
$loader->offerPageSize = $maxOffers;
}
$loader->filename = $filename; $loader->filename = $filename;
$loader->serverName = \Bitrix\Main\Context::getCurrent()->getServer()->getHttpHost(); $loader->serverName = \Bitrix\Main\Context::getCurrent()->getServer()->getHttpHost();
$loader->application = $APPLICATION; $loader->application = $APPLICATION;
@ -964,7 +975,8 @@ class intaro_retailcrm extends CModule
$propertiesUnitSKU, $propertiesUnitSKU,
$propertiesHbSKU, $propertiesHbSKU,
$propertiesHbProduct, $propertiesHbProduct,
$filename $filename,
$maxOffers
); );
$PROFILE_ID = CCatalogExport::Add(array( $PROFILE_ID = CCatalogExport::Add(array(
"LAST_USE" => false, "LAST_USE" => false,
@ -1213,7 +1225,8 @@ class intaro_retailcrm extends CModule
$propertiesUnitSKU, $propertiesUnitSKU,
$propertiesHbSKU, $propertiesHbSKU,
$propertiesHbProduct, $propertiesHbProduct,
$filename $filename,
$maxOffers
) { ) {
$strVars = ""; $strVars = "";
foreach ($iblocks as $key => $val) foreach ($iblocks as $key => $val)
@ -1244,6 +1257,7 @@ class intaro_retailcrm extends CModule
} }
$strVars .= 'SETUP_FILE_NAME=' . urlencode($filename); $strVars .= 'SETUP_FILE_NAME=' . urlencode($filename);
$strVars .= '&MAX_OFFERS_VALUE=' . urlencode($maxOffers);
return $strVars; return $strVars;
} }

View File

@ -17,6 +17,7 @@ if (!empty($oldValues)) {
$IBLOCK_PROPERTY_UNIT_PRODUCT = $oldValues['IBLOCK_PROPERTY_UNIT_PRODUCT']; $IBLOCK_PROPERTY_UNIT_PRODUCT = $oldValues['IBLOCK_PROPERTY_UNIT_PRODUCT'];
$SETUP_FILE_NAME = $oldValues['SETUP_FILE_NAME']; $SETUP_FILE_NAME = $oldValues['SETUP_FILE_NAME'];
$SETUP_PROFILE_NAME = $oldValues['SETUP_PROFILE_NAME']; $SETUP_PROFILE_NAME = $oldValues['SETUP_PROFILE_NAME'];
$MAX_OFFERS_VALUE = $oldValues['MAX_OFFERS_VALUE'];
} }
?> ?>
@ -475,6 +476,18 @@ if (!empty($oldValues)) {
<br> <br>
<br> <br>
<div id="profile-field" >
<font class="text"><?=GetMessage("OFFERS_VALUE") . ':';?>&nbsp<br><br></font>
<input
type="text"
name="MAX_OFFERS_VALUE"
value="<?= ($MAX_OFFERS_VALUE ? $MAX_OFFERS_VALUE: '');?>"
size="15">
<br>
<br>
<br>
</div>
<font class="text"><?=GetMessage("LOAD_PERIOD");?><br><br></font> <font class="text"><?=GetMessage("LOAD_PERIOD");?><br><br></font>
<input type="radio" name="TYPE_LOADING" value="none" onclick="checkProfile(this);"><?=GetMessage("NOT_LOADING");?><Br> <input type="radio" name="TYPE_LOADING" value="none" onclick="checkProfile(this);"><?=GetMessage("NOT_LOADING");?><Br>
<input type="radio" name="TYPE_LOADING" value="cron" onclick="checkProfile(this);"><?=GetMessage("CRON_LOADING");?><Br> <input type="radio" name="TYPE_LOADING" value="cron" onclick="checkProfile(this);"><?=GetMessage("CRON_LOADING");?><Br>

View File

@ -1,5 +1,5 @@
<? <?
$arModuleVersion = array( $arModuleVersion = array(
"VERSION" => "2.4.1", "VERSION" => "2.4.2",
"VERSION_DATE" => "2018-11-14 16:22:12" "VERSION_DATE" => "2018-12-26 11:00:00"
); );

View File

@ -44,3 +44,4 @@ $MESS["UNIT_MEASUREMENT_G"] = "г.";
$MESS["UNIT_MEASUREMENT_KG"] = "кг."; $MESS["UNIT_MEASUREMENT_KG"] = "кг.";
$MESS['BASE_PRICE'] = 'Базовая цена'; $MESS['BASE_PRICE'] = 'Базовая цена';
$MESS['WAIT'] = 'Загрузка...'; $MESS['WAIT'] = 'Загрузка...';
$MESS["OFFERS_VALUE"] = "Максимальное количество торговых предложений у товара";