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
|
## 2018-02-27 v.2.3.4
|
||||||
* Добавлена передача веса и габаритов в заказе
|
* Добавлена передача веса и габаритов в заказе
|
||||||
* Добавлена проверка существования fuser у корзины товаров перед сохранением
|
* Добавлена проверка существования fuser у корзины товаров перед сохранением
|
||||||
|
@ -276,7 +276,7 @@ class RCrmActions
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!is_array($string)) {
|
if (!is_array($string)) {
|
||||||
$string = self::unserializeRecursive($string);
|
$string = self::unserializeArrayRecursive($string);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $string;
|
return $string;
|
||||||
|
@ -141,6 +141,28 @@
|
|||||||
},
|
},
|
||||||
"personalDiscount": {
|
"personalDiscount": {
|
||||||
"type": "string"
|
"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": {
|
"orders": {
|
||||||
@ -297,6 +319,14 @@
|
|||||||
"bankAccount": {
|
"bankAccount": {
|
||||||
"type": "string"
|
"type": "string"
|
||||||
},
|
},
|
||||||
|
"shipmentDate": {
|
||||||
|
"type": "datetime",
|
||||||
|
"format": "Y-m-d"
|
||||||
|
},
|
||||||
|
"shipped": {
|
||||||
|
"type": "bool",
|
||||||
|
"default": false
|
||||||
|
},
|
||||||
"orderType": {
|
"orderType": {
|
||||||
"type": "string"
|
"type": "string"
|
||||||
},
|
},
|
||||||
@ -439,6 +469,36 @@
|
|||||||
},
|
},
|
||||||
"custom": {
|
"custom": {
|
||||||
"type": "string"
|
"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']);
|
$orderCrm = RCrmActions::apiMethod($api, 'orderGet', __METHOD__, $order['id']);
|
||||||
}
|
}
|
||||||
if ($orderCrm) {
|
if ($orderCrm) {
|
||||||
self::paymentsUpdate($newOrder, $orderCrm['order'], $api, $newHistoryPayments);
|
self::paymentsUpdate($newOrder, $orderCrm['order'], $newHistoryPayments);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1036,7 +1036,7 @@ class RetailCrmHistory
|
|||||||
if (!$shipment->isSystem()) {
|
if (!$shipment->isSystem()) {
|
||||||
$reserved = false;
|
$reserved = false;
|
||||||
|
|
||||||
if ($shipment->isReserved()) {
|
if ($shipment->needReservation()) {
|
||||||
$reserved = true;
|
$reserved = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1094,12 +1094,11 @@ class RetailCrmHistory
|
|||||||
*
|
*
|
||||||
* @param object $order
|
* @param object $order
|
||||||
* @param array $paymentsCrm
|
* @param array $paymentsCrm
|
||||||
* @param object $api
|
|
||||||
* @param array $newHistoryPayments
|
* @param array $newHistoryPayments
|
||||||
*
|
*
|
||||||
* @return void
|
* @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)));
|
$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)));
|
$optionsPayment = array_flip(unserialize(COption::GetOptionString(self::$MODULE_ID, self::$CRM_PAYMENT, 0)));
|
||||||
|
@ -1,4 +1,8 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
use Bitrix\Highloadblock as HL;
|
||||||
|
use Bitrix\Main\Entity;
|
||||||
|
|
||||||
IncludeModuleLangFile(__FILE__);
|
IncludeModuleLangFile(__FILE__);
|
||||||
class RetailCrmICML
|
class RetailCrmICML
|
||||||
{
|
{
|
||||||
@ -247,10 +251,29 @@ class RetailCrmICML
|
|||||||
);
|
);
|
||||||
|
|
||||||
foreach ($this->iblocks as $key => $id) {
|
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
|
// Get Info by infoblocks
|
||||||
$iblock['IBLOCK_DB'] = CIBlock::GetByID($id)->Fetch();
|
$iblock['IBLOCK_DB'] = CIBlock::GetByID($id)->Fetch();
|
||||||
$iblockOffer = CCatalogSKU::GetInfoByProductIBlock($id);
|
$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 (
|
$arSelect = Array (
|
||||||
"ID",
|
"ID",
|
||||||
"LID",
|
"LID",
|
||||||
@ -388,6 +411,13 @@ class RetailCrmICML
|
|||||||
$resPropertiesProduct[$key] *= $this->measurement[$this->propertiesUnitProduct[$id][$key]];
|
$resPropertiesProduct[$key] *= $this->measurement[$this->propertiesUnitProduct[$id][$key]];
|
||||||
$resPropertiesProduct[$key . "_UNIT"] = $this->measurementLink[$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] *= $this->measurement[$this->propertiesUnitSKU[$id][$key]];
|
||||||
$offer['_PROP_' . $key . "_UNIT"] = $this->measurementLink[$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];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -556,4 +592,23 @@ class RetailCrmICML
|
|||||||
|
|
||||||
return $offer;
|
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;
|
$order['items'][] = $item;
|
||||||
|
|
||||||
|
if ($send) {
|
||||||
$dimensions = RCrmActions::unserializeArrayRecursive($product['DIMENSIONS']);
|
$dimensions = RCrmActions::unserializeArrayRecursive($product['DIMENSIONS']);
|
||||||
$width += $dimensions['WIDTH'];
|
$width += $dimensions['WIDTH'];
|
||||||
$height += $dimensions['HEIGHT'];
|
$height += $dimensions['HEIGHT'];
|
||||||
$length += $dimensions['LENGTH'];
|
$length += $dimensions['LENGTH'];
|
||||||
$weight += $product['WEIGHT'];
|
$weight += $product['WEIGHT'];
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($send) {
|
||||||
$order['width'] = $width;
|
$order['width'] = $width;
|
||||||
$order['height'] = $height;
|
$order['height'] = $height;
|
||||||
$order['length'] = $length;
|
$order['length'] = $length;
|
||||||
$order['weight'] = $weight;
|
$order['weight'] = $weight;
|
||||||
|
}
|
||||||
|
|
||||||
//payments
|
//payments
|
||||||
$payments = array();
|
$payments = array();
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
- Добавлена передача веса и габаритов в заказе
|
- В настройку экспорта добавлена настройка свойств типа "справочник"(highloadblock)
|
||||||
- Добавлена проверка существования fuser у корзины товаров перед сохранением
|
- Добавлена проверка необходимости резервации товаров при выгрузке заказов из retailCRM
|
||||||
- Добавлено снятие резерва с товаров при отмене заказа в CRM
|
- Исправлен вызов рекурсивного метода в RCrmActions
|
||||||
- Исправлена выборка данных для UA, когда id заказа не совпадает с номером
|
- Добавлены недостающие поля 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(
|
$iblockProperties = array(
|
||||||
"article" => "article",
|
"article" => "article",
|
||||||
"manufacturer" => "manufacturer",
|
"manufacturer" => "manufacturer",
|
||||||
@ -34,6 +42,7 @@ if (file_exists($_SERVER["DOCUMENT_ROOT"]."/bitrix/php_interface/retailcrm/expor
|
|||||||
"height" => "height",
|
"height" => "height",
|
||||||
);
|
);
|
||||||
$IBLOCK_PROPERTY_SKU = array();
|
$IBLOCK_PROPERTY_SKU = array();
|
||||||
|
$IBLOCK_PROPERTY_SKU_HIGHLOADBLOCK = array();
|
||||||
$IBLOCK_PROPERTY_UNIT_SKU = array();
|
$IBLOCK_PROPERTY_UNIT_SKU = array();
|
||||||
foreach ($iblockProperties as $prop) {
|
foreach ($iblockProperties as $prop) {
|
||||||
$skuUnitProps = ('IBLOCK_PROPERTY_UNIT_SKU' . "_" . $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;
|
$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 = array();
|
||||||
|
$IBLOCK_PROPERTY_PRODUCT_HIGHLOADBLOCK = array();
|
||||||
$IBLOCK_PROPERTY_UNIT_PRODUCT = array();
|
$IBLOCK_PROPERTY_UNIT_PRODUCT = array();
|
||||||
foreach ($iblockProperties as $prop) {
|
foreach ($iblockProperties as $prop) {
|
||||||
$productUnitProps = "IBLOCK_PROPERTY_UNIT_PRODUCT" . "_" . $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;
|
$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();
|
$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->propertiesUnitSKU = $IBLOCK_PROPERTY_UNIT_SKU;
|
||||||
$loader->propertiesProduct = $IBLOCK_PROPERTY_PRODUCT;
|
$loader->propertiesProduct = $IBLOCK_PROPERTY_PRODUCT;
|
||||||
$loader->propertiesUnitProduct = $IBLOCK_PROPERTY_UNIT_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->filename = $SETUP_FILE_NAME;
|
||||||
$loader->serverName = $SERVER_NAME;
|
$loader->serverName = $SERVER_NAME;
|
||||||
$loader->application = $APPLICATION;
|
$loader->application = $APPLICATION;
|
||||||
|
@ -2,6 +2,24 @@
|
|||||||
if (file_exists($_SERVER["DOCUMENT_ROOT"]."/bitrix/php_interface/retailcrm/export_setup.php")){
|
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");
|
require_once($_SERVER["DOCUMENT_ROOT"]."/bitrix/php_interface/retailcrm/export_setup.php");
|
||||||
} else {
|
} 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(
|
$iblockProperties = array(
|
||||||
"article" => "article",
|
"article" => "article",
|
||||||
"manufacturer" => "manufacturer",
|
"manufacturer" => "manufacturer",
|
||||||
@ -32,6 +50,22 @@ if (file_exists($_SERVER["DOCUMENT_ROOT"]."/bitrix/php_interface/retailcrm/expor
|
|||||||
$arResult['PRICE_TYPES'][$arPriceType['ID']] = $arPriceType;
|
$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 (($ACTION == 'EXPORT' || $ACTION == 'EXPORT_EDIT' || $ACTION == 'EXPORT_COPY') && $STEP == 1)
|
||||||
{
|
{
|
||||||
if (isset($arOldSetupVars['SETUP_FILE_NAME']))
|
if (isset($arOldSetupVars['SETUP_FILE_NAME']))
|
||||||
@ -291,7 +325,7 @@ if (file_exists($_SERVER["DOCUMENT_ROOT"]."/bitrix/php_interface/retailcrm/expor
|
|||||||
>
|
>
|
||||||
</div>
|
</div>
|
||||||
<br>
|
<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%;"': "" )?> >
|
<table class="adm-list-table" id="export_setup" <?=($arIBlock['PROPERTIES_SKU'] == null ? 'style="width: 66%;"': "" )?> >
|
||||||
<thead>
|
<thead>
|
||||||
<tr class="adm-list-table-header">
|
<tr class="adm-list-table-header">
|
||||||
@ -324,6 +358,7 @@ if (file_exists($_SERVER["DOCUMENT_ROOT"]."/bitrix/php_interface/retailcrm/expor
|
|||||||
id="IBLOCK_PROPERTY_PRODUCT_<?=$key?><?=$arIBlock["ID"]?>"
|
id="IBLOCK_PROPERTY_PRODUCT_<?=$key?><?=$arIBlock["ID"]?>"
|
||||||
name="IBLOCK_PROPERTY_PRODUCT_<?=$key?>[<?=$arIBlock["ID"]?>]"
|
name="IBLOCK_PROPERTY_PRODUCT_<?=$key?>[<?=$arIBlock["ID"]?>]"
|
||||||
class="property-export"
|
class="property-export"
|
||||||
|
data-type="<?=$key?>"
|
||||||
onchange="propertyChange(this);">
|
onchange="propertyChange(this);">
|
||||||
<option value=""></option>
|
<option value=""></option>
|
||||||
<?if (version_compare(SM_VERSION, '14.0.0', '>=') && array_key_exists($key, $iblockFieldsName)) :?>
|
<?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): ?>
|
<? foreach ($arIBlock['PROPERTIES_PRODUCT'] as $prop): ?>
|
||||||
<option value="<?=$prop['CODE'] ?>"
|
<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 ($arIBlock['OLD_PROPERTY_PRODUCT_SELECT'] != null) {
|
||||||
if ($prop["CODE"] == $arIBlock['OLD_PROPERTY_PRODUCT_SELECT'][$key] ) {
|
if ($prop["CODE"] == $arIBlock['OLD_PROPERTY_PRODUCT_SELECT'][$key] ) {
|
||||||
echo " selected";
|
echo " selected";
|
||||||
$productSelected = true;
|
$productSelected = true;
|
||||||
|
if ($prop['USER_TYPE'] == 'directory') {
|
||||||
|
$selected = $prop['USER_TYPE_SETTINGS']['TABLE_NAME'];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
foreach ($iblockPropertiesHint[$key] as $hint) {
|
foreach ($iblockPropertiesHint[$key] as $hint) {
|
||||||
@ -386,7 +430,15 @@ if (file_exists($_SERVER["DOCUMENT_ROOT"]."/bitrix/php_interface/retailcrm/expor
|
|||||||
<?}?>
|
<?}?>
|
||||||
|
|
||||||
</select>
|
</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)) :?>
|
<?if (array_key_exists($key, $iblockFieldsName)) :?>
|
||||||
<select
|
<select
|
||||||
style="width: 100px; margin-left: 50px;"
|
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"]?>"
|
id="IBLOCK_PROPERTY_SKU_<?=$key?><?=$arIBlock["ID"]?>"
|
||||||
name="IBLOCK_PROPERTY_SKU_<?=$key?>[<?=$arIBlock["ID"]?>]"
|
name="IBLOCK_PROPERTY_SKU_<?=$key?>[<?=$arIBlock["ID"]?>]"
|
||||||
class="property-export"
|
class="property-export"
|
||||||
|
data-type="<?=$key?>"
|
||||||
onchange="propertyChange(this);">
|
onchange="propertyChange(this);">
|
||||||
|
|
||||||
<option value=""></option>
|
<option value=""></option>
|
||||||
@ -464,10 +517,19 @@ if (file_exists($_SERVER["DOCUMENT_ROOT"]."/bitrix/php_interface/retailcrm/expor
|
|||||||
<? foreach ($arIBlock['PROPERTIES_SKU'] as $prop): ?>
|
<? foreach ($arIBlock['PROPERTIES_SKU'] as $prop): ?>
|
||||||
<option value="<?=$prop['CODE'] ?>"
|
<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 (!$productSelected) {
|
||||||
if ($arIBlock['OLD_PROPERTY_SKU_SELECT'] != null) {
|
if ($arIBlock['OLD_PROPERTY_SKU_SELECT'] != null) {
|
||||||
if ($prop["CODE"] == $arIBlock['OLD_PROPERTY_SKU_SELECT'][$key] ) {
|
if ($prop["CODE"] == $arIBlock['OLD_PROPERTY_SKU_SELECT'][$key] ) {
|
||||||
echo " selected";
|
echo " selected";
|
||||||
|
if ($prop['USER_TYPE'] == 'directory') {
|
||||||
|
$selected = $prop['USER_TYPE_SETTINGS']['TABLE_NAME'];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
foreach ($iblockPropertiesHint[$key] as $hint) {
|
foreach ($iblockPropertiesHint[$key] as $hint) {
|
||||||
@ -487,7 +549,15 @@ if (file_exists($_SERVER["DOCUMENT_ROOT"]."/bitrix/php_interface/retailcrm/expor
|
|||||||
</optgroup>
|
</optgroup>
|
||||||
<? endif; ?>
|
<? endif; ?>
|
||||||
</select>
|
</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)) :?>
|
<?if (array_key_exists($key, $iblockFieldsName)) :?>
|
||||||
<select
|
<select
|
||||||
style="width: 100px; margin-left: 50px;"
|
style="width: 100px; margin-left: 50px;"
|
||||||
@ -653,12 +723,60 @@ if (file_exists($_SERVER["DOCUMENT_ROOT"]."/bitrix/php_interface/retailcrm/expor
|
|||||||
function propertyChange(obj)
|
function propertyChange(obj)
|
||||||
{
|
{
|
||||||
if (BX(obj.id).value !== 'none') {
|
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';
|
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';
|
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>
|
</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_UNIT_SKU_" . $val;
|
||||||
$vals .= ",IBLOCK_PROPERTY_PRODUCT_" . $val;
|
$vals .= ",IBLOCK_PROPERTY_PRODUCT_" . $val;
|
||||||
$vals .= ",IBLOCK_PROPERTY_UNIT_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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
@ -547,7 +547,11 @@ class intaro_retailcrm extends CModule
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
//order upload
|
//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('');
|
$historyTime = Date('');
|
||||||
RetailCrmOrder::uploadOrders(); // each 50
|
RetailCrmOrder::uploadOrders(); // each 50
|
||||||
|
|
||||||
@ -633,6 +637,27 @@ class intaro_retailcrm extends CModule
|
|||||||
);
|
);
|
||||||
|
|
||||||
} elseif ($step == 5) {
|
} 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")) {
|
if (!CModule::IncludeModule("iblock")) {
|
||||||
$arResult['errCode'] = 'ERR_IBLOCK';
|
$arResult['errCode'] = 'ERR_IBLOCK';
|
||||||
}
|
}
|
||||||
@ -743,6 +768,22 @@ class intaro_retailcrm extends CModule
|
|||||||
$iblocks = $_POST['IBLOCK_EXPORT'];
|
$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(
|
$iblockProperties = array(
|
||||||
"article" => "article",
|
"article" => "article",
|
||||||
"manufacturer" => "manufacturer",
|
"manufacturer" => "manufacturer",
|
||||||
@ -756,6 +797,7 @@ class intaro_retailcrm extends CModule
|
|||||||
|
|
||||||
$propertiesSKU = array();
|
$propertiesSKU = array();
|
||||||
$propertiesUnitSKU = array();
|
$propertiesUnitSKU = array();
|
||||||
|
$propertiesHbSKU = array();
|
||||||
foreach ($iblockProperties as $prop) {
|
foreach ($iblockProperties as $prop) {
|
||||||
foreach ($_POST['IBLOCK_PROPERTY_SKU'. '_' . $prop] as $iblock => $val) {
|
foreach ($_POST['IBLOCK_PROPERTY_SKU'. '_' . $prop] as $iblock => $val) {
|
||||||
$propertiesSKU[$iblock][$prop] = $val;
|
$propertiesSKU[$iblock][$prop] = $val;
|
||||||
@ -763,10 +805,16 @@ class intaro_retailcrm extends CModule
|
|||||||
foreach ($_POST['IBLOCK_PROPERTY_UNIT_SKU'. '_' . $prop] as $iblock => $val) {
|
foreach ($_POST['IBLOCK_PROPERTY_UNIT_SKU'. '_' . $prop] as $iblock => $val) {
|
||||||
$propertiesUnitSKU[$iblock][$prop] = $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();
|
$propertiesProduct = array();
|
||||||
$propertiesUnitProduct = array();
|
$propertiesUnitProduct = array();
|
||||||
|
$propertiesHbProduct = array();
|
||||||
foreach ($iblockProperties as $prop) {
|
foreach ($iblockProperties as $prop) {
|
||||||
foreach ($_POST['IBLOCK_PROPERTY_PRODUCT'. '_' . $prop] as $iblock => $val) {
|
foreach ($_POST['IBLOCK_PROPERTY_PRODUCT'. '_' . $prop] as $iblock => $val) {
|
||||||
$propertiesProduct[$iblock][$prop] = $val;
|
$propertiesProduct[$iblock][$prop] = $val;
|
||||||
@ -774,6 +822,11 @@ class intaro_retailcrm extends CModule
|
|||||||
foreach ($_POST['IBLOCK_PROPERTY_UNIT_PRODUCT'. '_' . $prop] as $iblock => $val) {
|
foreach ($_POST['IBLOCK_PROPERTY_UNIT_PRODUCT'. '_' . $prop] as $iblock => $val) {
|
||||||
$propertiesUnitProduct[$iblock][$prop] = $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'])) {
|
if (!isset($_POST['SETUP_FILE_NAME'])) {
|
||||||
@ -843,6 +896,8 @@ class intaro_retailcrm extends CModule
|
|||||||
$loader->propertiesProduct = $propertiesProduct;
|
$loader->propertiesProduct = $propertiesProduct;
|
||||||
$loader->propertiesUnitSKU = $propertiesUnitSKU;
|
$loader->propertiesUnitSKU = $propertiesUnitSKU;
|
||||||
$loader->propertiesSKU = $propertiesSKU;
|
$loader->propertiesSKU = $propertiesSKU;
|
||||||
|
$loader->highloadblockSkuProperties = $propertiesHbSKU;
|
||||||
|
$loader->highloadblockProductProperties = $propertiesHbProduct;
|
||||||
$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;
|
||||||
@ -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(
|
$PROFILE_ID = CCatalogExport::Add(array(
|
||||||
"LAST_USE" => false,
|
"LAST_USE" => false,
|
||||||
"FILE_NAME" => $this->RETAIL_CRM_EXPORT,
|
"FILE_NAME" => $this->RETAIL_CRM_EXPORT,
|
||||||
@ -1081,7 +1145,16 @@ class intaro_retailcrm extends CModule
|
|||||||
rmdir($defaultSite['ABS_DOC_ROOT'] . '/retailcrm/');
|
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 = "";
|
$strVars = "";
|
||||||
foreach ($iblocks as $key => $val)
|
foreach ($iblocks as $key => $val)
|
||||||
$strVars .= 'IBLOCK_EXPORT[' . $key . ']=' . $val . '&';
|
$strVars .= 'IBLOCK_EXPORT[' . $key . ']=' . $val . '&';
|
||||||
@ -1097,6 +1170,14 @@ class intaro_retailcrm extends CModule
|
|||||||
foreach ($propertiesUnitProduct as $iblock => $arr)
|
foreach ($propertiesUnitProduct as $iblock => $arr)
|
||||||
foreach ($arr as $id => $val)
|
foreach ($arr as $id => $val)
|
||||||
$strVars .= 'IBLOCK_PROPERTY_UNIT_PRODUCT_' . $id . '[' . $iblock . ']=' . $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);
|
$strVars .= 'SETUP_FILE_NAME=' . urlencode($filename);
|
||||||
|
|
||||||
|
@ -210,7 +210,7 @@ if (!empty($oldValues)) {
|
|||||||
>
|
>
|
||||||
</div>
|
</div>
|
||||||
<br>
|
<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%;"': "" )?> >
|
<table class="adm-list-table" id="export_setup" <?=($arIBlock['PROPERTIES_SKU'] == null ? 'style="width: 66%;"': "" )?> >
|
||||||
<thead>
|
<thead>
|
||||||
<tr class="adm-list-table-header">
|
<tr class="adm-list-table-header">
|
||||||
@ -243,6 +243,7 @@ if (!empty($oldValues)) {
|
|||||||
id="IBLOCK_PROPERTY_PRODUCT_<?=$key?><?=$arIBlock["ID"]?>"
|
id="IBLOCK_PROPERTY_PRODUCT_<?=$key?><?=$arIBlock["ID"]?>"
|
||||||
name="IBLOCK_PROPERTY_PRODUCT_<?=$key?>[<?=$arIBlock["ID"]?>]"
|
name="IBLOCK_PROPERTY_PRODUCT_<?=$key?>[<?=$arIBlock["ID"]?>]"
|
||||||
class="property-export"
|
class="property-export"
|
||||||
|
data-type="<?=$key?>"
|
||||||
onchange="propertyChange(this);">
|
onchange="propertyChange(this);">
|
||||||
<option value=""></option>
|
<option value=""></option>
|
||||||
<?if (version_compare(SM_VERSION, '14.0.0', '>=') && array_key_exists($key, $iblockFieldsName) && $arIBlock['PROPERTIES_SKU'] == null) :?>
|
<?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): ?>
|
<? foreach ($arIBlock['PROPERTIES_PRODUCT'] as $prop): ?>
|
||||||
<option value="<?=$prop['CODE'] ?>"
|
<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 ($arIBlock['OLD_PROPERTY_PRODUCT_SELECT'] != null) {
|
||||||
if ($prop["CODE"] == $arIBlock['OLD_PROPERTY_PRODUCT_SELECT'][$key] ) {
|
if ($prop["CODE"] == $arIBlock['OLD_PROPERTY_PRODUCT_SELECT'][$key] ) {
|
||||||
echo " selected";
|
echo " selected";
|
||||||
@ -342,6 +349,7 @@ if (!empty($oldValues)) {
|
|||||||
id="IBLOCK_PROPERTY_SKU_<?=$key?><?=$arIBlock["ID"]?>"
|
id="IBLOCK_PROPERTY_SKU_<?=$key?><?=$arIBlock["ID"]?>"
|
||||||
name="IBLOCK_PROPERTY_SKU_<?=$key?>[<?=$arIBlock["ID"]?>]"
|
name="IBLOCK_PROPERTY_SKU_<?=$key?>[<?=$arIBlock["ID"]?>]"
|
||||||
class="property-export"
|
class="property-export"
|
||||||
|
data-type="<?=$key?>"
|
||||||
onchange="propertyChange(this);">
|
onchange="propertyChange(this);">
|
||||||
|
|
||||||
<option value=""></option>
|
<option value=""></option>
|
||||||
@ -380,6 +388,12 @@ if (!empty($oldValues)) {
|
|||||||
<? foreach ($arIBlock['PROPERTIES_SKU'] as $prop): ?>
|
<? foreach ($arIBlock['PROPERTIES_SKU'] as $prop): ?>
|
||||||
<option value="<?=$prop['CODE'] ?>"
|
<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 (!$productSelected) {
|
||||||
if ($arIBlock['OLD_PROPERTY_SKU_SELECT'] != null) {
|
if ($arIBlock['OLD_PROPERTY_SKU_SELECT'] != null) {
|
||||||
if ($prop["CODE"] == $arIBlock['OLD_PROPERTY_SKU_SELECT'][$key] ) {
|
if ($prop["CODE"] == $arIBlock['OLD_PROPERTY_SKU_SELECT'][$key] ) {
|
||||||
@ -570,10 +584,15 @@ if (!empty($oldValues)) {
|
|||||||
function propertyChange(obj)
|
function propertyChange(obj)
|
||||||
{
|
{
|
||||||
if (BX(obj.id).value !== 'none') {
|
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';
|
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';
|
BX(obj.id.replace('PRODUCT','SKU')).value = 'none';
|
||||||
|
var bid = obj.id.replace('PRODUCT','SKU');
|
||||||
|
$("#" + bid).siblings('#highloadblock').remove();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
function checkProfile(obj)
|
function checkProfile(obj)
|
||||||
@ -583,6 +602,57 @@ if (!empty($oldValues)) {
|
|||||||
else
|
else
|
||||||
$('#profile-field').hide();
|
$('#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>
|
</script>
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
<?
|
<?
|
||||||
$arModuleVersion = array(
|
$arModuleVersion = array(
|
||||||
"VERSION" => "2.3.4",
|
"VERSION" => "2.3.5",
|
||||||
"VERSION_DATE" => "2018-02-27 17:15:00"
|
"VERSION_DATE" => "2018-03-22 17:15:00"
|
||||||
);
|
);
|
||||||
|
@ -42,3 +42,4 @@ $MESS["UNIT_MEASUREMENT_MG"] = "мг.";
|
|||||||
$MESS["UNIT_MEASUREMENT_G"] = "г.";
|
$MESS["UNIT_MEASUREMENT_G"] = "г.";
|
||||||
$MESS["UNIT_MEASUREMENT_KG"] = "кг.";
|
$MESS["UNIT_MEASUREMENT_KG"] = "кг.";
|
||||||
$MESS['BASE_PRICE'] = 'Базовая цена';
|
$MESS['BASE_PRICE'] = 'Базовая цена';
|
||||||
|
$MESS['WAIT'] = 'Загрузка...';
|
||||||
|
@ -23,3 +23,4 @@ $MESS ['ERR_FIELDS_IBLOCK'] = 'Не выбрано ни одного инфор
|
|||||||
$MESS ['ERR_FIELDS_ARTICLE'] = 'Не выбраны артикулы';
|
$MESS ['ERR_FIELDS_ARTICLE'] = 'Не выбраны артикулы';
|
||||||
$MESS ['ERR_FIELDS_FILE'] = 'Не указано имя файла';
|
$MESS ['ERR_FIELDS_FILE'] = 'Не указано имя файла';
|
||||||
$MESS ['BASE_PRICE'] = 'Базовая цена';
|
$MESS ['BASE_PRICE'] = 'Базовая цена';
|
||||||
|
$MESS ['WAIT'] = 'Загрузка...';
|
Loading…
Reference in New Issue
Block a user