v.2.3.5
This commit is contained in:
parent
1e1426f6d3
commit
7ae099236c
@ -1,3 +1,9 @@
|
||||
## 2018-03-22 v.2.3.5
|
||||
* В настройку экспорта добавлена настройка свойств типа "справочник"(highloadblock)
|
||||
* Добавлена проверка необходимости резервации товаров при выгрузке заказов из retailCRM
|
||||
* Исправлен вызов рекурсивного метода в RCrmActions
|
||||
* Добавлены недостающие поля retailcrm.json
|
||||
|
||||
## 2018-02-27 v.2.3.4
|
||||
* Добавлена передача веса и габаритов в заказе
|
||||
* Добавлена проверка существования fuser у корзины товаров перед сохранением
|
||||
|
@ -276,7 +276,7 @@ class RCrmActions
|
||||
}
|
||||
|
||||
if (!is_array($string)) {
|
||||
$string = self::unserializeRecursive($string);
|
||||
$string = self::unserializeArrayRecursive($string);
|
||||
}
|
||||
|
||||
return $string;
|
||||
|
@ -131,7 +131,7 @@
|
||||
"type": "string"
|
||||
},
|
||||
"managerId": {
|
||||
"type": "int"
|
||||
"type": "int"
|
||||
},
|
||||
"browserId": {
|
||||
"type": "string"
|
||||
@ -141,6 +141,28 @@
|
||||
},
|
||||
"personalDiscount": {
|
||||
"type": "string"
|
||||
},
|
||||
"sex": {
|
||||
"type": "string"
|
||||
},
|
||||
"emailMarketingUnsubscribedAt" : {
|
||||
"type": "datetime",
|
||||
"format": "Y-m-d"
|
||||
},
|
||||
"source": {
|
||||
"type": "string"
|
||||
},
|
||||
"medium": {
|
||||
"type": "string"
|
||||
},
|
||||
"campaign": {
|
||||
"type": "string"
|
||||
},
|
||||
"keyword": {
|
||||
"type": "string"
|
||||
},
|
||||
"content": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"orders": {
|
||||
@ -297,6 +319,14 @@
|
||||
"bankAccount": {
|
||||
"type": "string"
|
||||
},
|
||||
"shipmentDate": {
|
||||
"type": "datetime",
|
||||
"format": "Y-m-d"
|
||||
},
|
||||
"shipped": {
|
||||
"type": "bool",
|
||||
"default": false
|
||||
},
|
||||
"orderType": {
|
||||
"type": "string"
|
||||
},
|
||||
@ -439,6 +469,36 @@
|
||||
},
|
||||
"custom": {
|
||||
"type": "string"
|
||||
},
|
||||
"vatRate": {
|
||||
"type": "string"
|
||||
},
|
||||
"name": {
|
||||
"type": "string"
|
||||
},
|
||||
"value": {
|
||||
"type": "string"
|
||||
},
|
||||
"xmlId": {
|
||||
"type": "string"
|
||||
},
|
||||
"netCost": {
|
||||
"type": "double"
|
||||
},
|
||||
"source": {
|
||||
"type": "string"
|
||||
},
|
||||
"medium": {
|
||||
"type": "string"
|
||||
},
|
||||
"campaign": {
|
||||
"type": "string"
|
||||
},
|
||||
"keyword": {
|
||||
"type": "string"
|
||||
},
|
||||
"content": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
@ -697,7 +697,7 @@ class RetailCrmHistory
|
||||
$orderCrm = RCrmActions::apiMethod($api, 'orderGet', __METHOD__, $order['id']);
|
||||
}
|
||||
if ($orderCrm) {
|
||||
self::paymentsUpdate($newOrder, $orderCrm['order'], $api, $newHistoryPayments);
|
||||
self::paymentsUpdate($newOrder, $orderCrm['order'], $newHistoryPayments);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1036,7 +1036,7 @@ class RetailCrmHistory
|
||||
if (!$shipment->isSystem()) {
|
||||
$reserved = false;
|
||||
|
||||
if ($shipment->isReserved()) {
|
||||
if ($shipment->needReservation()) {
|
||||
$reserved = true;
|
||||
}
|
||||
|
||||
@ -1094,12 +1094,11 @@ class RetailCrmHistory
|
||||
*
|
||||
* @param object $order
|
||||
* @param array $paymentsCrm
|
||||
* @param object $api
|
||||
* @param array $newHistoryPayments
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public static function paymentsUpdate($order, $paymentsCrm, $api, &$newHistoryPayments = array())
|
||||
public static function paymentsUpdate($order, $paymentsCrm, &$newHistoryPayments = array())
|
||||
{
|
||||
$optionsPayTypes = array_flip(unserialize(COption::GetOptionString(self::$MODULE_ID, self::$CRM_PAYMENT_TYPES, 0)));
|
||||
$optionsPayment = array_flip(unserialize(COption::GetOptionString(self::$MODULE_ID, self::$CRM_PAYMENT, 0)));
|
||||
|
@ -1,4 +1,8 @@
|
||||
<?php
|
||||
|
||||
use Bitrix\Highloadblock as HL;
|
||||
use Bitrix\Main\Entity;
|
||||
|
||||
IncludeModuleLangFile(__FILE__);
|
||||
class RetailCrmICML
|
||||
{
|
||||
@ -227,13 +231,13 @@ class RetailCrmICML
|
||||
protected function BuildCategory($arCategory)
|
||||
{
|
||||
return "
|
||||
<category id=\"" . $this->PrepareValue($arCategory["ID"]) . "\""
|
||||
. ( intval($arCategory["IBLOCK_SECTION_ID"] ) > 0 ?
|
||||
" parentId=\"" . $this->PrepareValue($arCategory["IBLOCK_SECTION_ID"]) . "\""
|
||||
:"")
|
||||
. ">"
|
||||
. $this->PrepareValue($arCategory["NAME"])
|
||||
. "</category>\n";
|
||||
<category id=\"" . $this->PrepareValue($arCategory["ID"]) . "\""
|
||||
. ( intval($arCategory["IBLOCK_SECTION_ID"] ) > 0 ?
|
||||
" parentId=\"" . $this->PrepareValue($arCategory["IBLOCK_SECTION_ID"]) . "\""
|
||||
:"")
|
||||
. ">"
|
||||
. $this->PrepareValue($arCategory["NAME"])
|
||||
. "</category>\n";
|
||||
|
||||
}
|
||||
|
||||
@ -247,10 +251,29 @@ class RetailCrmICML
|
||||
);
|
||||
|
||||
foreach ($this->iblocks as $key => $id) {
|
||||
$highloadblockSkuProps = array();
|
||||
$highloadblockProductProps = array();
|
||||
|
||||
$productProps = CIBlockproperty::GetList(array(), array("IBLOCK_ID" => $id));
|
||||
while ($arrProductProps = $productProps->Fetch()) {
|
||||
|
||||
if ($arrProductProps["USER_TYPE"] == 'directory') {
|
||||
$highloadblockProductProps[$arrProductProps['CODE']] = $arrProductProps;
|
||||
}
|
||||
}
|
||||
|
||||
// Get Info by infoblocks
|
||||
$iblock['IBLOCK_DB'] = CIBlock::GetByID($id)->Fetch();
|
||||
$iblockOffer = CCatalogSKU::GetInfoByProductIBlock($id);
|
||||
|
||||
$skuProps = CIBlockproperty::GetList(array(), array("IBLOCK_ID" => $iblockOffer['IBLOCK_ID']));
|
||||
while ($arrSkuProps = $skuProps->Fetch()) {
|
||||
|
||||
if ($arrSkuProps["USER_TYPE"] == 'directory') {
|
||||
$highloadblockSkuProps[$arrSkuProps['CODE']] = $arrSkuProps;
|
||||
}
|
||||
}
|
||||
|
||||
$arSelect = Array (
|
||||
"ID",
|
||||
"LID",
|
||||
@ -388,6 +411,13 @@ class RetailCrmICML
|
||||
$resPropertiesProduct[$key] *= $this->measurement[$this->propertiesUnitProduct[$id][$key]];
|
||||
$resPropertiesProduct[$key . "_UNIT"] = $this->measurementLink[$this->propertiesUnitProduct[$id][$key]];
|
||||
}
|
||||
if (isset($highloadblockProductProps[$propProduct])) {
|
||||
$propVal = $this->getHBprop($highloadblockProductProps[$propProduct], $offer["PROPERTY_" . $propProduct . "_VALUE"]);
|
||||
$tableName = $highloadblockProductProps[$propProduct]['USER_TYPE_SETTINGS']['TABLE_NAME'];
|
||||
$field = $this->highloadblockSkuProperties[$tableName][$iblockOffer['IBLOCK_ID']][$key];
|
||||
|
||||
$resPropertiesProduct[$key] = $propVal[$field];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -432,6 +462,12 @@ class RetailCrmICML
|
||||
$offer['_PROP_' . $key] *= $this->measurement[$this->propertiesUnitSKU[$id][$key]];
|
||||
$offer['_PROP_' . $key . "_UNIT"] = $this->measurementLink[$this->propertiesUnitSKU[$id][$key]];
|
||||
}
|
||||
if (isset($highloadblockSkuProps[$propSKU])) {
|
||||
$propVal = $this->getHBprop($highloadblockSkuProps[$propSKU], $offer["PROPERTY_" . $propSKU . "_VALUE"]);
|
||||
$tableName = $highloadblockSkuProps[$propSKU]['USER_TYPE_SETTINGS']['TABLE_NAME'];
|
||||
$field = $this->highloadblockSkuProperties[$tableName][$id][$key];
|
||||
$offer['_PROP_' . $key] = $propVal[$field];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -555,5 +591,24 @@ class RetailCrmICML
|
||||
$offer.= "</offer>\n";
|
||||
|
||||
return $offer;
|
||||
}
|
||||
}
|
||||
|
||||
private function getHBprop($hbProp, $xml_id)
|
||||
{
|
||||
CModule::IncludeModule('highloadblock');
|
||||
$hlblockArr = \Bitrix\Highloadblock\HighloadBlockTable::getList([
|
||||
'filter' => ['=TABLE_NAME' => $hbProp['USER_TYPE_SETTINGS']['TABLE_NAME']]
|
||||
])->fetch();
|
||||
|
||||
$hlblock = HL\HighloadBlockTable::getById($hlblockArr["ID"])->fetch();
|
||||
$entity = HL\HighloadBlockTable::compileEntity($hlblock);
|
||||
$entityClass = $entity->getDataClass();
|
||||
|
||||
$result = $entityClass::getList(array(
|
||||
'select' => array('*'),
|
||||
'filter' => array('UF_XML_ID' => $xml_id)
|
||||
));
|
||||
|
||||
return $result->fetch();
|
||||
}
|
||||
}
|
@ -147,17 +147,21 @@ class RetailCrmOrder
|
||||
|
||||
$order['items'][] = $item;
|
||||
|
||||
$dimensions = RCrmActions::unserializeArrayRecursive($product['DIMENSIONS']);
|
||||
$width += $dimensions['WIDTH'];
|
||||
$height += $dimensions['HEIGHT'];
|
||||
$length += $dimensions['LENGTH'];
|
||||
$weight += $product['WEIGHT'];
|
||||
if ($send) {
|
||||
$dimensions = RCrmActions::unserializeArrayRecursive($product['DIMENSIONS']);
|
||||
$width += $dimensions['WIDTH'];
|
||||
$height += $dimensions['HEIGHT'];
|
||||
$length += $dimensions['LENGTH'];
|
||||
$weight += $product['WEIGHT'];
|
||||
}
|
||||
}
|
||||
|
||||
$order['width'] = $width;
|
||||
$order['height'] = $height;
|
||||
$order['length'] = $length;
|
||||
$order['weight'] = $weight;
|
||||
if ($send) {
|
||||
$order['width'] = $width;
|
||||
$order['height'] = $height;
|
||||
$order['length'] = $length;
|
||||
$order['weight'] = $weight;
|
||||
}
|
||||
|
||||
//payments
|
||||
$payments = array();
|
||||
|
@ -1,5 +1,4 @@
|
||||
- Добавлена передача веса и габаритов в заказе
|
||||
- Добавлена проверка существования fuser у корзины товаров перед сохранением
|
||||
- Добавлено снятие резерва с товаров при отмене заказа в CRM
|
||||
- Исправлена выборка данных для UA, когда id заказа не совпадает с номером
|
||||
- Исправлены мелкие баги
|
||||
- В настройку экспорта добавлена настройка свойств типа "справочник"(highloadblock)
|
||||
- Добавлена проверка необходимости резервации товаров при выгрузке заказов из retailCRM
|
||||
- Исправлен вызов рекурсивного метода в RCrmActions
|
||||
- Добавлены недостающие поля retailcrm.json
|
||||
|
@ -23,6 +23,14 @@ if (file_exists($_SERVER["DOCUMENT_ROOT"]."/bitrix/php_interface/retailcrm/expor
|
||||
}
|
||||
}
|
||||
|
||||
CModule::IncludeModule('highloadblock');
|
||||
$hlblockList = array();
|
||||
$hlblockListDb = \Bitrix\Highloadblock\HighloadBlockTable::getList();
|
||||
|
||||
while ($hlblockArr = $hlblockListDb->Fetch()) {
|
||||
$hlblockList[$hlblockArr["TABLE_NAME"]] = $hlblockArr;
|
||||
}
|
||||
|
||||
$iblockProperties = array(
|
||||
"article" => "article",
|
||||
"manufacturer" => "manufacturer",
|
||||
@ -34,6 +42,7 @@ if (file_exists($_SERVER["DOCUMENT_ROOT"]."/bitrix/php_interface/retailcrm/expor
|
||||
"height" => "height",
|
||||
);
|
||||
$IBLOCK_PROPERTY_SKU = array();
|
||||
$IBLOCK_PROPERTY_SKU_HIGHLOADBLOCK = array();
|
||||
$IBLOCK_PROPERTY_UNIT_SKU = array();
|
||||
foreach ($iblockProperties as $prop) {
|
||||
$skuUnitProps = ('IBLOCK_PROPERTY_UNIT_SKU' . "_" . $prop);
|
||||
@ -51,8 +60,20 @@ if (file_exists($_SERVER["DOCUMENT_ROOT"]."/bitrix/php_interface/retailcrm/expor
|
||||
$IBLOCK_PROPERTY_SKU[$iblock][$prop] = $val;
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($hlblockList as $hlblockTable => $hlblock) {
|
||||
$hbProps = ('highloadblock' . $hlblockTable . '_' . $prop);
|
||||
$hbProps = $$hbProps;
|
||||
|
||||
if (is_array($hbProps)) {
|
||||
foreach ($hbProps as $iblock => $val) {
|
||||
$IBLOCK_PROPERTY_SKU_HIGHLOADBLOCK[$hlblockTable][$iblock][$prop] = $val;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
$IBLOCK_PROPERTY_PRODUCT = array();
|
||||
$IBLOCK_PROPERTY_PRODUCT_HIGHLOADBLOCK = array();
|
||||
$IBLOCK_PROPERTY_UNIT_PRODUCT = array();
|
||||
foreach ($iblockProperties as $prop) {
|
||||
$productUnitProps = "IBLOCK_PROPERTY_UNIT_PRODUCT" . "_" . $prop;
|
||||
@ -70,6 +91,17 @@ if (file_exists($_SERVER["DOCUMENT_ROOT"]."/bitrix/php_interface/retailcrm/expor
|
||||
$IBLOCK_PROPERTY_PRODUCT[$iblock][$prop] = $val;
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($hlblockList as $hlblockTable => $hlblock) {
|
||||
$hbProps = ('highloadblock_product' . $hlblockTable . '_' . $prop);
|
||||
$hbProps = $$hbProps;
|
||||
|
||||
if (is_array($hbProps)) {
|
||||
foreach ($hbProps as $iblock => $val) {
|
||||
$IBLOCK_PROPERTY_PRODUCT_HIGHLOADBLOCK[$hlblockTable][$iblock][$prop] = $val;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$loader = new RetailCrmICML();
|
||||
@ -79,6 +111,8 @@ if (file_exists($_SERVER["DOCUMENT_ROOT"]."/bitrix/php_interface/retailcrm/expor
|
||||
$loader->propertiesUnitSKU = $IBLOCK_PROPERTY_UNIT_SKU;
|
||||
$loader->propertiesProduct = $IBLOCK_PROPERTY_PRODUCT;
|
||||
$loader->propertiesUnitProduct = $IBLOCK_PROPERTY_UNIT_PRODUCT;
|
||||
$loader->highloadblockSkuProperties = $IBLOCK_PROPERTY_SKU_HIGHLOADBLOCK;
|
||||
$loader->highloadblockProductProperties = $IBLOCK_PROPERTY_PRODUCT_HIGHLOADBLOCK;
|
||||
$loader->filename = $SETUP_FILE_NAME;
|
||||
$loader->serverName = $SERVER_NAME;
|
||||
$loader->application = $APPLICATION;
|
||||
|
@ -2,6 +2,24 @@
|
||||
if (file_exists($_SERVER["DOCUMENT_ROOT"]."/bitrix/php_interface/retailcrm/export_setup.php")){
|
||||
require_once($_SERVER["DOCUMENT_ROOT"]."/bitrix/php_interface/retailcrm/export_setup.php");
|
||||
} else {
|
||||
if (isset($_POST['ajax']) && $_POST['ajax'] == '1') {
|
||||
CModule::IncludeModule('highloadblock');
|
||||
$rsData = \Bitrix\Highloadblock\HighloadBlockTable::getList(array('filter' => array('TABLE_NAME' => $_POST['table'])));
|
||||
$hlblockArr = $rsData->Fetch();
|
||||
$hlblock = \Bitrix\Highloadblock\HighloadBlockTable::getById($hlblockArr["ID"])->fetch();
|
||||
$entity = \Bitrix\Highloadblock\HighloadBlockTable::compileEntity($hlblock);
|
||||
$hbFields = $entity->getFields();
|
||||
$hlblockList['table'] = $hlblockArr["TABLE_NAME"];
|
||||
|
||||
foreach ($hbFields as $hbFieldCode => $hbField) {
|
||||
$hlblockList['fields'][] = $hbFieldCode;
|
||||
}
|
||||
|
||||
$APPLICATION->RestartBuffer();
|
||||
header('Content-Type: application/x-javascript; charset=' . LANG_CHARSET);
|
||||
die(json_encode($hlblockList));
|
||||
}
|
||||
|
||||
$iblockProperties = array(
|
||||
"article" => "article",
|
||||
"manufacturer" => "manufacturer",
|
||||
@ -32,6 +50,22 @@ if (file_exists($_SERVER["DOCUMENT_ROOT"]."/bitrix/php_interface/retailcrm/expor
|
||||
$arResult['PRICE_TYPES'][$arPriceType['ID']] = $arPriceType;
|
||||
}
|
||||
|
||||
//highloadblock
|
||||
CModule::IncludeModule('highloadblock');
|
||||
$hlblockList = array();
|
||||
$hlblockListDb = \Bitrix\Highloadblock\HighloadBlockTable::getList();
|
||||
|
||||
while ($hlblockArr = $hlblockListDb->Fetch()) {
|
||||
$hlblock = \Bitrix\Highloadblock\HighloadBlockTable::getById($hlblockArr["ID"])->fetch();
|
||||
$entity = \Bitrix\Highloadblock\HighloadBlockTable::compileEntity($hlblock);
|
||||
$hbFields = $entity->getFields();
|
||||
$hlblockList[$hlblockArr["TABLE_NAME"]]['LABEL'] = $hlblockArr["NAME"];
|
||||
|
||||
foreach ($hbFields as $hbFieldCode => $hbField) {
|
||||
$hlblockList[$hlblockArr["TABLE_NAME"]]['FIELDS'][] = $hbFieldCode;
|
||||
}
|
||||
}
|
||||
|
||||
if (($ACTION == 'EXPORT' || $ACTION == 'EXPORT_EDIT' || $ACTION == 'EXPORT_COPY') && $STEP == 1)
|
||||
{
|
||||
if (isset($arOldSetupVars['SETUP_FILE_NAME']))
|
||||
@ -291,7 +325,7 @@ if (file_exists($_SERVER["DOCUMENT_ROOT"]."/bitrix/php_interface/retailcrm/expor
|
||||
>
|
||||
</div>
|
||||
<br>
|
||||
<div id="IBLOCK_EXPORT_TABLE<?=$checkBoxCounter?>">
|
||||
<div id="IBLOCK_EXPORT_TABLE<?=$checkBoxCounter?>" class="IBLOCK_EXPORT_TABLE" data-type="<?=$arIBlock["ID"]?>">
|
||||
<table class="adm-list-table" id="export_setup" <?=($arIBlock['PROPERTIES_SKU'] == null ? 'style="width: 66%;"': "" )?> >
|
||||
<thead>
|
||||
<tr class="adm-list-table-header">
|
||||
@ -315,7 +349,7 @@ if (file_exists($_SERVER["DOCUMENT_ROOT"]."/bitrix/php_interface/retailcrm/expor
|
||||
|
||||
<tr class="adm-list-table-row">
|
||||
<td class="adm-list-table-cell">
|
||||
<? echo htmlspecialcharsex($property); ?>
|
||||
<? echo htmlspecialcharsex($property); ?>
|
||||
</td>
|
||||
|
||||
<td class="adm-list-table-cell">
|
||||
@ -324,6 +358,7 @@ if (file_exists($_SERVER["DOCUMENT_ROOT"]."/bitrix/php_interface/retailcrm/expor
|
||||
id="IBLOCK_PROPERTY_PRODUCT_<?=$key?><?=$arIBlock["ID"]?>"
|
||||
name="IBLOCK_PROPERTY_PRODUCT_<?=$key?>[<?=$arIBlock["ID"]?>]"
|
||||
class="property-export"
|
||||
data-type="<?=$key?>"
|
||||
onchange="propertyChange(this);">
|
||||
<option value=""></option>
|
||||
<?if (version_compare(SM_VERSION, '14.0.0', '>=') && array_key_exists($key, $iblockFieldsName)) :?>
|
||||
@ -362,10 +397,19 @@ if (file_exists($_SERVER["DOCUMENT_ROOT"]."/bitrix/php_interface/retailcrm/expor
|
||||
<? foreach ($arIBlock['PROPERTIES_PRODUCT'] as $prop): ?>
|
||||
<option value="<?=$prop['CODE'] ?>"
|
||||
<?
|
||||
if ($prop['USER_TYPE'] == 'directory') {
|
||||
echo 'class="highloadblock-product"';
|
||||
echo 'id="'. $prop['USER_TYPE_SETTINGS']['TABLE_NAME'] .'"';
|
||||
} else {
|
||||
echo 'class="not-highloadblock"';
|
||||
}
|
||||
if ($arIBlock['OLD_PROPERTY_PRODUCT_SELECT'] != null) {
|
||||
if ($prop["CODE"] == $arIBlock['OLD_PROPERTY_PRODUCT_SELECT'][$key] ) {
|
||||
echo " selected";
|
||||
$productSelected = true;
|
||||
if ($prop['USER_TYPE'] == 'directory') {
|
||||
$selected = $prop['USER_TYPE_SETTINGS']['TABLE_NAME'];
|
||||
}
|
||||
}
|
||||
} else {
|
||||
foreach ($iblockPropertiesHint[$key] as $hint) {
|
||||
@ -386,7 +430,15 @@ if (file_exists($_SERVER["DOCUMENT_ROOT"]."/bitrix/php_interface/retailcrm/expor
|
||||
<?}?>
|
||||
|
||||
</select>
|
||||
|
||||
<? if (isset($selected)
|
||||
&& isset($arOldSetupVars['highloadblock_product' . $selected . '_' . $key][$arIBlock['ID']])
|
||||
) : ?>
|
||||
<select name="highloadblock_product<?=$selected;?>_<?=$key;?>[<? echo $arIBlock['ID']?>]" id="highloadblock" style="width: 100px; margin-left: 50px;">
|
||||
<? foreach ($hlblockList[$selected]['FIELDS'] as $field) : ?>
|
||||
<option value="<?=$field;?>"<? if ($arOldSetupVars['highloadblock_product' . $selected . '_' . $key][$arIBlock['ID']] == $field) : echo "selected"; endif; ?>><?=$field;?></option>
|
||||
<? endforeach; ?>
|
||||
</select>
|
||||
<? endif; ?>
|
||||
<?if (array_key_exists($key, $iblockFieldsName)) :?>
|
||||
<select
|
||||
style="width: 100px; margin-left: 50px;"
|
||||
@ -425,6 +477,7 @@ if (file_exists($_SERVER["DOCUMENT_ROOT"]."/bitrix/php_interface/retailcrm/expor
|
||||
id="IBLOCK_PROPERTY_SKU_<?=$key?><?=$arIBlock["ID"]?>"
|
||||
name="IBLOCK_PROPERTY_SKU_<?=$key?>[<?=$arIBlock["ID"]?>]"
|
||||
class="property-export"
|
||||
data-type="<?=$key?>"
|
||||
onchange="propertyChange(this);">
|
||||
|
||||
<option value=""></option>
|
||||
@ -464,10 +517,19 @@ if (file_exists($_SERVER["DOCUMENT_ROOT"]."/bitrix/php_interface/retailcrm/expor
|
||||
<? foreach ($arIBlock['PROPERTIES_SKU'] as $prop): ?>
|
||||
<option value="<?=$prop['CODE'] ?>"
|
||||
<?
|
||||
if ($prop['USER_TYPE'] == 'directory') {
|
||||
echo 'class="highloadblock"';
|
||||
echo 'id="'. $prop['USER_TYPE_SETTINGS']['TABLE_NAME'] .'"';
|
||||
} else {
|
||||
echo 'class="not-highloadblock"';
|
||||
}
|
||||
if (!$productSelected) {
|
||||
if ($arIBlock['OLD_PROPERTY_SKU_SELECT'] != null) {
|
||||
if ($prop["CODE"] == $arIBlock['OLD_PROPERTY_SKU_SELECT'][$key] ) {
|
||||
echo " selected";
|
||||
if ($prop['USER_TYPE'] == 'directory') {
|
||||
$selected = $prop['USER_TYPE_SETTINGS']['TABLE_NAME'];
|
||||
}
|
||||
}
|
||||
} else {
|
||||
foreach ($iblockPropertiesHint[$key] as $hint) {
|
||||
@ -487,7 +549,15 @@ if (file_exists($_SERVER["DOCUMENT_ROOT"]."/bitrix/php_interface/retailcrm/expor
|
||||
</optgroup>
|
||||
<? endif; ?>
|
||||
</select>
|
||||
|
||||
<? if (isset($selected)
|
||||
&& isset($arOldSetupVars['highloadblock' . $selected . '_' . $key][$arIBlock['ID']])
|
||||
) : ?>
|
||||
<select name="highloadblock<?=$selected;?>_<?=$key;?>[<? echo $arIBlock['ID']?>]" id="highloadblock" style="width: 100px; margin-left: 50px;">
|
||||
<? foreach ($hlblockList[$selected]['FIELDS'] as $field) : ?>
|
||||
<option value="<?=$field;?>"<? if ($arOldSetupVars['highloadblock' . $selected . '_' . $key][$arIBlock['ID']] == $field) : echo "selected"; endif; ?>><?=$field;?></option>
|
||||
<? endforeach; ?>
|
||||
</select>
|
||||
<? endif; ?>
|
||||
<?if (array_key_exists($key, $iblockFieldsName)) :?>
|
||||
<select
|
||||
style="width: 100px; margin-left: 50px;"
|
||||
@ -653,12 +723,60 @@ if (file_exists($_SERVER["DOCUMENT_ROOT"]."/bitrix/php_interface/retailcrm/expor
|
||||
function propertyChange(obj)
|
||||
{
|
||||
if (BX(obj.id).value !== 'none') {
|
||||
if (obj.id.indexOf("SKU") !== -1)
|
||||
if (obj.id.indexOf("SKU") !== -1) {
|
||||
BX(obj.id.replace('SKU','PRODUCT')).value = 'none';
|
||||
else
|
||||
var bid = obj.id.replace('SKU','PRODUCT');
|
||||
$("#" + bid).siblings('#highloadblock').remove();
|
||||
} else {
|
||||
BX(obj.id.replace('PRODUCT','SKU')).value = 'none';
|
||||
var bid = obj.id.replace('PRODUCT','SKU');
|
||||
$("#" + bid).siblings('#highloadblock').remove();
|
||||
}
|
||||
}
|
||||
};
|
||||
$('.highloadblock').on('click', function() {
|
||||
getHbFromAjax($(this), 'sku');
|
||||
});
|
||||
$('.highloadblock-product').on('click', function() {
|
||||
getHbFromAjax($(this), 'product');
|
||||
});
|
||||
$('.not-highloadblock').on('click', function() {
|
||||
var a = $(this).parent('select').siblings('#highloadblock');
|
||||
$(a).remove();
|
||||
});
|
||||
function getHbFromAjax(that, type) {
|
||||
var url = $('td .adm-list-table-cell').parents('form').attr('action');
|
||||
var get = '<?php echo http_build_query($_GET); ?>';
|
||||
var td = $(that).parents('td .adm-list-table-cell');
|
||||
var select = $(that).parent('select').siblings('#highloadblock');
|
||||
var table_name = $(that).attr('id');
|
||||
var iblock = $(that).parents('.IBLOCK_EXPORT_TABLE').attr('data-type');
|
||||
var key = $(that).parent('select').attr('data-type');
|
||||
|
||||
$.ajax({
|
||||
url: url + '?' + get,
|
||||
type: 'POST',
|
||||
data: {ajax: '1', table: table_name},
|
||||
dataType: "json",
|
||||
success: function(res) {
|
||||
$(select).remove();
|
||||
$('#waiting').remove();
|
||||
var new_options = '';
|
||||
$.each(res.fields, function(key, value) {
|
||||
new_options += '<option value="' + value + '">' + value + '</option>';
|
||||
});
|
||||
if (type === 'sku') {
|
||||
$(td).append('<select name="highloadblock' + res.table + '_' + key + '[' + iblock + ']" id="highloadblock" style="width: 100px; margin-left: 50px;">' + new_options + '</select>');
|
||||
}
|
||||
if (type === 'product') {
|
||||
$(td).append('<select name="highloadblock_product' + res.table + '_' + key + '[' + iblock + ']" id="highloadblock" style="width: 100px; margin-left: 50px;">' + new_options + '</select>');
|
||||
}
|
||||
},
|
||||
beforeSend: function() {
|
||||
$(td).append('<span style="margin-left:50px;" id="waiting"><?=GetMessage("WAIT")?></span>');
|
||||
}
|
||||
});
|
||||
}
|
||||
</script>
|
||||
|
||||
<?//Следующие переменные должны быть обязательно установлены?>
|
||||
@ -671,6 +789,14 @@ if (file_exists($_SERVER["DOCUMENT_ROOT"]."/bitrix/php_interface/retailcrm/expor
|
||||
$vals .= ",IBLOCK_PROPERTY_UNIT_SKU_" . $val;
|
||||
$vals .= ",IBLOCK_PROPERTY_PRODUCT_" . $val;
|
||||
$vals .= ",IBLOCK_PROPERTY_UNIT_PRODUCT_" . $val;
|
||||
|
||||
foreach ($hlblockList as $hlblockTable => $hlblock) {
|
||||
$vals .= ',highloadblock'. $hlblockTable .'_' . $val;
|
||||
}
|
||||
|
||||
foreach ($hlblockList as $hlblockTable => $hlblock) {
|
||||
$vals .= ',highloadblock_product'. $hlblockTable .'_' . $val;
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
|
@ -534,7 +534,7 @@ class intaro_retailcrm extends CModule
|
||||
}
|
||||
|
||||
$APPLICATION->IncludeAdminFile(
|
||||
GetMessage('MODULE_INSTALL_TITLE'), $this->INSTALL_PATH . '/step3.php'
|
||||
GetMessage('MODULE_INSTALL_TITLE'), $this->INSTALL_PATH . '/step3.php'
|
||||
);
|
||||
} elseif ($step == 4) {
|
||||
if (!CModule::IncludeModule("sale")) {
|
||||
@ -547,7 +547,11 @@ class intaro_retailcrm extends CModule
|
||||
);
|
||||
}
|
||||
//order upload
|
||||
if (!empty($_SERVER['HTTP_X_REQUESTED_WITH']) && (strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest') && isset($_POST['ajax']) && ($_POST['ajax'] == 1)) {
|
||||
if (!empty($_SERVER['HTTP_X_REQUESTED_WITH'])
|
||||
&& (strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest')
|
||||
&& isset($_POST['ajax'])
|
||||
&& $_POST['ajax'] == 1
|
||||
) {
|
||||
$historyTime = Date('');
|
||||
RetailCrmOrder::uploadOrders(); // each 50
|
||||
|
||||
@ -558,7 +562,7 @@ class intaro_retailcrm extends CModule
|
||||
if (!isset($_POST['finish'])) {
|
||||
$finish = 0;
|
||||
} else {
|
||||
$finish = (int) $_POST['finish'];
|
||||
$finish = (int)$_POST['finish'];
|
||||
}
|
||||
$percent = round(100 - ($countLeft * 100 / $countAll), 1);
|
||||
|
||||
@ -572,7 +576,7 @@ class intaro_retailcrm extends CModule
|
||||
|
||||
if (isset($_POST['back']) && $_POST['back']) {
|
||||
$APPLICATION->IncludeAdminFile(
|
||||
GetMessage('MODULE_INSTALL_TITLE'), $this->INSTALL_PATH . '/step2.php'
|
||||
GetMessage('MODULE_INSTALL_TITLE'), $this->INSTALL_PATH . '/step2.php'
|
||||
);
|
||||
}
|
||||
|
||||
@ -629,10 +633,31 @@ class intaro_retailcrm extends CModule
|
||||
COption::SetOptionString($this->MODULE_ID, $this->CRM_CONTRAGENT_TYPE, serialize(RCrmActions::clearArr($contragentTypeArr)));
|
||||
|
||||
$APPLICATION->IncludeAdminFile(
|
||||
GetMessage('MODULE_INSTALL_TITLE'), $this->INSTALL_PATH . '/step4.php'
|
||||
GetMessage('MODULE_INSTALL_TITLE'), $this->INSTALL_PATH . '/step4.php'
|
||||
);
|
||||
|
||||
} elseif ($step == 5) {
|
||||
if (!empty($_SERVER['HTTP_X_REQUESTED_WITH'])
|
||||
&& (strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest')
|
||||
&& isset($_POST['ajax'])
|
||||
&& $_POST['ajax'] == 1
|
||||
) {
|
||||
CModule::IncludeModule('highloadblock');
|
||||
$rsData = \Bitrix\Highloadblock\HighloadBlockTable::getList(array('filter' => array('TABLE_NAME' => $_POST['table'])));
|
||||
$hlblockArr = $rsData->Fetch();
|
||||
$hlblock = \Bitrix\Highloadblock\HighloadBlockTable::getById($hlblockArr["ID"])->fetch();
|
||||
$entity = \Bitrix\Highloadblock\HighloadBlockTable::compileEntity($hlblock);
|
||||
$hbFields = $entity->getFields();
|
||||
$hlblockList['table'] = $hlblockArr["TABLE_NAME"];
|
||||
|
||||
foreach ($hbFields as $hbFieldCode => $hbField) {
|
||||
$hlblockList['fields'][] = $hbFieldCode;
|
||||
}
|
||||
|
||||
$APPLICATION->RestartBuffer();
|
||||
header('Content-Type: application/x-javascript; charset=' . LANG_CHARSET);
|
||||
die(json_encode($hlblockList));
|
||||
}
|
||||
if (!CModule::IncludeModule("iblock")) {
|
||||
$arResult['errCode'] = 'ERR_IBLOCK';
|
||||
}
|
||||
@ -710,7 +735,7 @@ class intaro_retailcrm extends CModule
|
||||
}
|
||||
|
||||
$APPLICATION->IncludeAdminFile(
|
||||
GetMessage('MODULE_INSTALL_TITLE'), $this->INSTALL_PATH . '/step5.php'
|
||||
GetMessage('MODULE_INSTALL_TITLE'), $this->INSTALL_PATH . '/step5.php'
|
||||
);
|
||||
} elseif ($step == 6) {
|
||||
if (!CModule::IncludeModule("iblock")) {
|
||||
@ -725,7 +750,7 @@ class intaro_retailcrm extends CModule
|
||||
|
||||
if (isset($arResult['errCode']) && $arResult['errCode']) {
|
||||
$APPLICATION->IncludeAdminFile(
|
||||
GetMessage('MODULE_INSTALL_TITLE'), $this->INSTALL_PATH . '/step5.php'
|
||||
GetMessage('MODULE_INSTALL_TITLE'), $this->INSTALL_PATH . '/step5.php'
|
||||
);
|
||||
|
||||
return;
|
||||
@ -733,7 +758,7 @@ class intaro_retailcrm extends CModule
|
||||
|
||||
if (isset($_POST['back']) && $_POST['back']) {
|
||||
$APPLICATION->IncludeAdminFile(
|
||||
GetMessage('MODULE_INSTALL_TITLE'), $this->INSTALL_PATH . '/step3.php'
|
||||
GetMessage('MODULE_INSTALL_TITLE'), $this->INSTALL_PATH . '/step3.php'
|
||||
);
|
||||
}
|
||||
|
||||
@ -742,20 +767,37 @@ class intaro_retailcrm extends CModule
|
||||
} else {
|
||||
$iblocks = $_POST['IBLOCK_EXPORT'];
|
||||
}
|
||||
|
||||
|
||||
//highloadblock
|
||||
CModule::IncludeModule('highloadblock');
|
||||
$hlblockList = array();
|
||||
$hlblockListDb = \Bitrix\Highloadblock\HighloadBlockTable::getList();
|
||||
|
||||
while ($hlblockArr = $hlblockListDb->Fetch()) {
|
||||
$hlblock = \Bitrix\Highloadblock\HighloadBlockTable::getById($hlblockArr["ID"])->fetch();
|
||||
$entity = \Bitrix\Highloadblock\HighloadBlockTable::compileEntity($hlblock);
|
||||
$hbFields = $entity->getFields();
|
||||
$hlblockList[$hlblockArr["TABLE_NAME"]]['LABEL'] = $hlblockArr["NAME"];
|
||||
|
||||
foreach ($hbFields as $hbFieldCode => $hbField) {
|
||||
$hlblockList[$hlblockArr["TABLE_NAME"]]['FIELDS'][] = $hbFieldCode;
|
||||
}
|
||||
}
|
||||
|
||||
$iblockProperties = array(
|
||||
"article" => "article",
|
||||
"manufacturer" => "manufacturer",
|
||||
"color" => "color",
|
||||
"weight" => "weight",
|
||||
"size" => "size",
|
||||
"length" => "length",
|
||||
"width" => "width",
|
||||
"height" => "height",
|
||||
);
|
||||
"article" => "article",
|
||||
"manufacturer" => "manufacturer",
|
||||
"color" => "color",
|
||||
"weight" => "weight",
|
||||
"size" => "size",
|
||||
"length" => "length",
|
||||
"width" => "width",
|
||||
"height" => "height",
|
||||
);
|
||||
|
||||
$propertiesSKU = array();
|
||||
$propertiesUnitSKU = array();
|
||||
$propertiesHbSKU = array();
|
||||
foreach ($iblockProperties as $prop) {
|
||||
foreach ($_POST['IBLOCK_PROPERTY_SKU'. '_' . $prop] as $iblock => $val) {
|
||||
$propertiesSKU[$iblock][$prop] = $val;
|
||||
@ -763,10 +805,16 @@ class intaro_retailcrm extends CModule
|
||||
foreach ($_POST['IBLOCK_PROPERTY_UNIT_SKU'. '_' . $prop] as $iblock => $val) {
|
||||
$propertiesUnitSKU[$iblock][$prop] = $val;
|
||||
}
|
||||
foreach ($hlblockList as $tableName => $hb) {
|
||||
foreach ($_POST['highloadblock' . $tableName . '_' . $prop] as $iblock => $val) {
|
||||
$propertiesHbSKU[$tableName][$iblock][$prop] = $val;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$propertiesProduct = array();
|
||||
$propertiesUnitProduct = array();
|
||||
$propertiesHbProduct = array();
|
||||
foreach ($iblockProperties as $prop) {
|
||||
foreach ($_POST['IBLOCK_PROPERTY_PRODUCT'. '_' . $prop] as $iblock => $val) {
|
||||
$propertiesProduct[$iblock][$prop] = $val;
|
||||
@ -774,6 +822,11 @@ class intaro_retailcrm extends CModule
|
||||
foreach ($_POST['IBLOCK_PROPERTY_UNIT_PRODUCT'. '_' . $prop] as $iblock => $val) {
|
||||
$propertiesUnitProduct[$iblock][$prop] = $val;
|
||||
}
|
||||
foreach ($hlblockList as $tableName => $hb) {
|
||||
foreach ($_POST['highloadblock_product' . $tableName . '_' . $prop] as $iblock => $val) {
|
||||
$propertiesHbProduct[$tableName][$iblock][$prop] = $val;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!isset($_POST['SETUP_FILE_NAME'])) {
|
||||
@ -843,6 +896,8 @@ class intaro_retailcrm extends CModule
|
||||
$loader->propertiesProduct = $propertiesProduct;
|
||||
$loader->propertiesUnitSKU = $propertiesUnitSKU;
|
||||
$loader->propertiesSKU = $propertiesSKU;
|
||||
$loader->highloadblockSkuProperties = $propertiesHbSKU;
|
||||
$loader->highloadblockProductProperties = $propertiesHbProduct;
|
||||
$loader->filename = $filename;
|
||||
$loader->serverName = \Bitrix\Main\Context::getCurrent()->getServer()->getHttpHost();
|
||||
$loader->application = $APPLICATION;
|
||||
@ -860,7 +915,16 @@ class intaro_retailcrm extends CModule
|
||||
}
|
||||
}
|
||||
}
|
||||
$ar = $this->GetProfileSetupVars($iblocks, $propertiesProduct, $propertiesUnitProduct, $propertiesSKU, $propertiesUnitSKU, $filename);
|
||||
$ar = $this->GetProfileSetupVars(
|
||||
$iblocks,
|
||||
$propertiesProduct,
|
||||
$propertiesUnitProduct,
|
||||
$propertiesSKU,
|
||||
$propertiesUnitSKU,
|
||||
$propertiesHbSKU,
|
||||
$propertiesHbProduct,
|
||||
$filename
|
||||
);
|
||||
$PROFILE_ID = CCatalogExport::Add(array(
|
||||
"LAST_USE" => false,
|
||||
"FILE_NAME" => $this->RETAIL_CRM_EXPORT,
|
||||
@ -1081,7 +1145,16 @@ class intaro_retailcrm extends CModule
|
||||
rmdir($defaultSite['ABS_DOC_ROOT'] . '/retailcrm/');
|
||||
}
|
||||
|
||||
function GetProfileSetupVars($iblocks, $propertiesProduct, $propertiesUnitProduct, $propertiesSKU, $propertiesUnitSKU, $filename) {
|
||||
function GetProfileSetupVars(
|
||||
$iblocks,
|
||||
$propertiesProduct,
|
||||
$propertiesUnitProduct,
|
||||
$propertiesSKU,
|
||||
$propertiesUnitSKU,
|
||||
$propertiesHbSKU,
|
||||
$propertiesHbProduct,
|
||||
$filename
|
||||
) {
|
||||
$strVars = "";
|
||||
foreach ($iblocks as $key => $val)
|
||||
$strVars .= 'IBLOCK_EXPORT[' . $key . ']=' . $val . '&';
|
||||
@ -1097,9 +1170,17 @@ class intaro_retailcrm extends CModule
|
||||
foreach ($propertiesUnitProduct as $iblock => $arr)
|
||||
foreach ($arr as $id => $val)
|
||||
$strVars .= 'IBLOCK_PROPERTY_UNIT_PRODUCT_' . $id . '[' . $iblock . ']=' . $val . '&';
|
||||
|
||||
foreach ($propertiesHbSKU as $table => $arr)
|
||||
foreach ($arr as $iblock => $val)
|
||||
foreach ($val as $id => $value)
|
||||
$strVars .= 'highloadblock' . $table . '_' . $id . '[' . $iblock . ']=' . $value . '&';
|
||||
foreach ($propertiesHbProduct as $table => $arr)
|
||||
foreach ($arr as $iblock => $val)
|
||||
foreach ($val as $id => $value)
|
||||
$strVars .= 'highloadblock_product' . $table . '_' . $id . '[' . $iblock . ']=' . $value . '&';
|
||||
|
||||
$strVars .= 'SETUP_FILE_NAME=' . urlencode($filename);
|
||||
|
||||
|
||||
return $strVars;
|
||||
}
|
||||
|
||||
|
@ -210,7 +210,7 @@ if (!empty($oldValues)) {
|
||||
>
|
||||
</div>
|
||||
<br>
|
||||
<div id="IBLOCK_EXPORT_TABLE<?=$checkBoxCounter?>">
|
||||
<div id="IBLOCK_EXPORT_TABLE<?=$checkBoxCounter?>" class="IBLOCK_EXPORT_TABLE" data-type="<?=$arIBlock["ID"]?>">
|
||||
<table class="adm-list-table" id="export_setup" <?=($arIBlock['PROPERTIES_SKU'] == null ? 'style="width: 66%;"': "" )?> >
|
||||
<thead>
|
||||
<tr class="adm-list-table-header">
|
||||
@ -243,6 +243,7 @@ if (!empty($oldValues)) {
|
||||
id="IBLOCK_PROPERTY_PRODUCT_<?=$key?><?=$arIBlock["ID"]?>"
|
||||
name="IBLOCK_PROPERTY_PRODUCT_<?=$key?>[<?=$arIBlock["ID"]?>]"
|
||||
class="property-export"
|
||||
data-type="<?=$key?>"
|
||||
onchange="propertyChange(this);">
|
||||
<option value=""></option>
|
||||
<?if (version_compare(SM_VERSION, '14.0.0', '>=') && array_key_exists($key, $iblockFieldsName) && $arIBlock['PROPERTIES_SKU'] == null) :?>
|
||||
@ -281,6 +282,12 @@ if (!empty($oldValues)) {
|
||||
<? foreach ($arIBlock['PROPERTIES_PRODUCT'] as $prop): ?>
|
||||
<option value="<?=$prop['CODE'] ?>"
|
||||
<?
|
||||
if ($prop['USER_TYPE'] == 'directory') {
|
||||
echo 'class="highloadblock-product"';
|
||||
echo 'id="'. $prop['USER_TYPE_SETTINGS']['TABLE_NAME'] .'"';
|
||||
} else {
|
||||
echo 'class="not-highloadblock"';
|
||||
}
|
||||
if ($arIBlock['OLD_PROPERTY_PRODUCT_SELECT'] != null) {
|
||||
if ($prop["CODE"] == $arIBlock['OLD_PROPERTY_PRODUCT_SELECT'][$key] ) {
|
||||
echo " selected";
|
||||
@ -342,6 +349,7 @@ if (!empty($oldValues)) {
|
||||
id="IBLOCK_PROPERTY_SKU_<?=$key?><?=$arIBlock["ID"]?>"
|
||||
name="IBLOCK_PROPERTY_SKU_<?=$key?>[<?=$arIBlock["ID"]?>]"
|
||||
class="property-export"
|
||||
data-type="<?=$key?>"
|
||||
onchange="propertyChange(this);">
|
||||
|
||||
<option value=""></option>
|
||||
@ -380,6 +388,12 @@ if (!empty($oldValues)) {
|
||||
<? foreach ($arIBlock['PROPERTIES_SKU'] as $prop): ?>
|
||||
<option value="<?=$prop['CODE'] ?>"
|
||||
<?
|
||||
if ($prop['USER_TYPE'] == 'directory') {
|
||||
echo 'class="highloadblock"';
|
||||
echo 'id="'. $prop['USER_TYPE_SETTINGS']['TABLE_NAME'] .'"';
|
||||
} else {
|
||||
echo 'class="not-highloadblock"';
|
||||
}
|
||||
if (!$productSelected) {
|
||||
if ($arIBlock['OLD_PROPERTY_SKU_SELECT'] != null) {
|
||||
if ($prop["CODE"] == $arIBlock['OLD_PROPERTY_SKU_SELECT'][$key] ) {
|
||||
@ -570,10 +584,15 @@ if (!empty($oldValues)) {
|
||||
function propertyChange(obj)
|
||||
{
|
||||
if (BX(obj.id).value !== 'none') {
|
||||
if (obj.id.indexOf("SKU") !== -1)
|
||||
if (obj.id.indexOf("SKU") !== -1) {
|
||||
BX(obj.id.replace('SKU','PRODUCT')).value = 'none';
|
||||
else
|
||||
var bid = obj.id.replace('SKU','PRODUCT');
|
||||
$("#" + bid).siblings('#highloadblock').remove();
|
||||
} else {
|
||||
BX(obj.id.replace('PRODUCT','SKU')).value = 'none';
|
||||
var bid = obj.id.replace('PRODUCT','SKU');
|
||||
$("#" + bid).siblings('#highloadblock').remove();
|
||||
}
|
||||
}
|
||||
};
|
||||
function checkProfile(obj)
|
||||
@ -583,6 +602,57 @@ if (!empty($oldValues)) {
|
||||
else
|
||||
$('#profile-field').hide();
|
||||
};
|
||||
$('.highloadblock').on('click', function() {
|
||||
getHbFromAjax($(this), 'sku');
|
||||
});
|
||||
$('.highloadblock-product').on('click', function() {
|
||||
getHbFromAjax($(this), 'product');
|
||||
});
|
||||
$('.not-highloadblock').on('click', function() {
|
||||
var a = $(this).parent('select').siblings('#highloadblock');
|
||||
$(a).remove();
|
||||
});
|
||||
function getHbFromAjax(that, type) {
|
||||
var url = $('td .adm-list-table-cell').parents('form').attr('action');
|
||||
var td = $(that).parents('td .adm-list-table-cell');
|
||||
var select = $(that).parent('select').siblings('#highloadblock');
|
||||
var table_name = $(that).attr('id');
|
||||
var iblock = $(that).parents('.IBLOCK_EXPORT_TABLE').attr('data-type');
|
||||
var key = $(that).parent('select').attr('data-type');
|
||||
|
||||
var step = $('input[name="continue"]').val();
|
||||
var id = $('input[name="id"]').val();
|
||||
var install = $('input[name="install"]').val();
|
||||
var sessid = BX.bitrix_sessid();
|
||||
|
||||
var data = 'install=' + install +'&step=' + step + '&sessid=' + sessid +
|
||||
'&id=' + id + '&ajax=1&table=' + table_name;
|
||||
|
||||
$.ajax({
|
||||
url: url,
|
||||
type: 'POST',
|
||||
data: data,
|
||||
dataType: "json",
|
||||
success: function(res) {
|
||||
$(select).remove();
|
||||
$('#waiting').remove();
|
||||
var new_options = '';
|
||||
$.each(res.fields, function(key, value) {
|
||||
new_options += '<option value="' + value + '">' + value + '</option>';
|
||||
});
|
||||
if (type == 'sku') {
|
||||
$(td).append('<select name="highloadblock' + res.table + '_' + key + '[' + iblock + ']" id="highloadblock" style="width: 100px; margin-left: 50px;">' + new_options + '</select>');
|
||||
}
|
||||
if (type == 'product') {
|
||||
$(td).append('<select name="highloadblock_product' + res.table + '_' + key + '[' + iblock + ']" id="highloadblock" style="width: 100px; margin-left: 50px;">' + new_options + '</select>');
|
||||
}
|
||||
|
||||
},
|
||||
beforeSend: function() {
|
||||
$(td).append('<span style="margin-left:50px;" id="waiting"><?=GetMessage("WAIT")?></span>');
|
||||
}
|
||||
});
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
<?
|
||||
$arModuleVersion = array(
|
||||
"VERSION" => "2.3.4",
|
||||
"VERSION_DATE" => "2018-02-27 17:15:00"
|
||||
"VERSION" => "2.3.5",
|
||||
"VERSION_DATE" => "2018-03-22 17:15:00"
|
||||
);
|
||||
|
@ -41,4 +41,5 @@ $MESS["UNIT_MEASUREMENT_M"] = "м.";
|
||||
$MESS["UNIT_MEASUREMENT_MG"] = "мг.";
|
||||
$MESS["UNIT_MEASUREMENT_G"] = "г.";
|
||||
$MESS["UNIT_MEASUREMENT_KG"] = "кг.";
|
||||
$MESS['BASE_PRICE'] = 'Базовая цена';
|
||||
$MESS['BASE_PRICE'] = 'Базовая цена';
|
||||
$MESS['WAIT'] = 'Загрузка...';
|
||||
|
@ -22,4 +22,5 @@ $MESS ['ERR_FIELDS_PROFILE'] = 'Неверно заполнено поле им
|
||||
$MESS ['ERR_FIELDS_IBLOCK'] = 'Не выбрано ни одного информационного блока';
|
||||
$MESS ['ERR_FIELDS_ARTICLE'] = 'Не выбраны артикулы';
|
||||
$MESS ['ERR_FIELDS_FILE'] = 'Не указано имя файла';
|
||||
$MESS ['BASE_PRICE'] = 'Базовая цена';
|
||||
$MESS ['BASE_PRICE'] = 'Базовая цена';
|
||||
$MESS ['WAIT'] = 'Загрузка...';
|
Loading…
Reference in New Issue
Block a user