v.2.2.0.1
This commit is contained in:
parent
9dcc482664
commit
c26f03960d
20 changed files with 412 additions and 354 deletions
|
@ -42,7 +42,7 @@ class RCrmActions
|
|||
$arDeliveryServiceAll = \Bitrix\Sale\Delivery\Services\Manager::getActiveList();
|
||||
$noOrderId = \Bitrix\Sale\Delivery\Services\EmptyDeliveryService::getEmptyDeliveryServiceId();
|
||||
foreach ($arDeliveryServiceAll as $arDeliveryService) {
|
||||
if ($arDeliveryService['PARENT_ID'] == '0' && $arDeliveryService['ID'] != $noOrderId) {
|
||||
if (($arDeliveryService['PARENT_ID'] == '0' || $arDeliveryService['PARENT_ID'] == null) && $arDeliveryService['ID'] != $noOrderId) {
|
||||
$bitrixDeliveryTypesList[] = $arDeliveryService;
|
||||
}
|
||||
}
|
||||
|
@ -63,7 +63,7 @@ class RCrmActions
|
|||
|
||||
return $bitrixPaymentTypesList;
|
||||
}
|
||||
|
||||
|
||||
public static function StatusesList()
|
||||
{
|
||||
$bitrixPaymentStatusesList = array();
|
||||
|
@ -79,9 +79,9 @@ class RCrmActions
|
|||
}
|
||||
|
||||
return $bitrixPaymentStatusesList;
|
||||
}
|
||||
|
||||
public static function OrderPropsList()
|
||||
}
|
||||
|
||||
public static function OrderPropsList()
|
||||
{
|
||||
$bitrixPropsList = array();
|
||||
$arPropsAll = \Bitrix\Sale\Internals\OrderPropsTable::getList(array(
|
||||
|
@ -251,7 +251,7 @@ class RCrmActions
|
|||
public static function explodeFIO($fio)
|
||||
{
|
||||
$result = array();
|
||||
$fio = preg_replace("/ +/", " ", trim($fio));
|
||||
$fio = preg_replace('|[\s]+|s', ' ', trim($fio));
|
||||
if (empty($fio)) {
|
||||
return $result;
|
||||
} else {
|
||||
|
@ -314,12 +314,23 @@ class RCrmActions
|
|||
$result = call_user_func_array(array($api, $methodApi), $params);
|
||||
|
||||
if ($result->getStatusCode() !== 200 && $result->getStatusCode() !== 201) {
|
||||
$arResult = (array)$result;
|
||||
$log = new Logger();
|
||||
if ($methodApi == 'customersUpload' || $methodApi == 'ordersUpload') {
|
||||
$log->write(array($methodApi, $result['errorMsg'], $result['errors'], $params), 'uploadApiErrors');
|
||||
$log->write(array(
|
||||
'methodApi' => $methodApi,
|
||||
'errorMsg' => $arResult['errorMsg'],
|
||||
'errors' => !empty($arResult['errors']) ? $arResult['errors'] : '',
|
||||
'params' => $params
|
||||
), 'uploadApiErrors');
|
||||
} else {
|
||||
self::eventLog(__CLASS__ . '::' . $method, 'RetailCrm\ApiClient::' . $methodApi, $result['errorMsg']);
|
||||
$log->write(array($methodApi, $result['errorMsg'], $result['errors'], $params), 'apiErrors');
|
||||
self::eventLog(__CLASS__ . '::' . $method, 'RetailCrm\ApiClient::' . $methodApi, $arResult['errorMsg']);
|
||||
$log->write(array(
|
||||
'methodApi' => $methodApi,
|
||||
'errorMsg' => $arResult['errorMsg'],
|
||||
'errors' => !empty($arResult['errors']) ? $arResult['errors'] : '',
|
||||
'params' => $params
|
||||
), 'apiErrors');
|
||||
}
|
||||
if ($result->getStatusCode() == 460) {
|
||||
return true;
|
||||
|
|
|
@ -64,7 +64,7 @@ class RestNormalizer
|
|||
if (is_null($file) || is_file($file) === false
|
||||
|| json_decode(file_get_contents($file)) === null
|
||||
|| $this->parseConfig($file) === false) {
|
||||
ICrmOrderActions::eventLog('RestNormalizer', 'intaro.retailcrm', 'Incorrect file normalize.');
|
||||
RCrmActions::eventLog('RestNormalizer', 'intaro.retailcrm', 'Incorrect file normalize.');
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -79,7 +79,7 @@ class RestNormalizer
|
|||
}
|
||||
|
||||
if (!is_array($data) || count($data) < 1) {
|
||||
ICrmOrderActions::eventLog('RestNormalizer', 'intaro.retailcrm', 'Incorrect data array.');
|
||||
RCrmActions::eventLog('RestNormalizer', 'intaro.retailcrm', 'Incorrect data array.');
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -123,7 +123,7 @@ class RestNormalizer
|
|||
if ($skip === false) {
|
||||
foreach ($this->validation as $code => $valid) {
|
||||
if (isset($valid['required']) && $valid['required'] === true && isset($formatted[ $code ]) === false) {
|
||||
//ICrmOrderActions::eventLog('RestNormalizer', 'intaro.retailcrm', "NOT VALID: $code");
|
||||
RCrmActions::eventLog('RestNormalizer', 'intaro.retailcrm', "NOT VALID: $code");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -7,10 +7,10 @@ class RetailCrmCollector
|
|||
|
||||
public static function add()
|
||||
{
|
||||
$key = COption::GetOptionString(self::$MODULE_ID, self::$CRM_COLL_KEY, 0);
|
||||
$keys = unserialize(COption::GetOptionString(self::$MODULE_ID, self::$CRM_COLL_KEY, 0));
|
||||
$collector = COption::GetOptionString(self::$MODULE_ID, self::$CRM_COLL, 0);
|
||||
|
||||
if ($collector === 'Y' && $key && ADMIN_SECTION !== true) {
|
||||
if ($collector === 'Y' && !empty($keys[SITE_ID]) && ADMIN_SECTION !== true) {
|
||||
global $APPLICATION;
|
||||
global $USER;
|
||||
|
||||
|
@ -19,12 +19,11 @@ class RetailCrmCollector
|
|||
$params['customerId'] = $USER->GetID();
|
||||
}
|
||||
|
||||
$str = "<script>
|
||||
$str = "<script type=\"text/javascript\">
|
||||
(function(_,r,e,t,a,i,l){_['retailCRMObject']=a;_[a]=_[a]||function(){(_[a].q=_[a].q||[]).push(arguments)};_[a].l=1*new Date();l=r.getElementsByTagName(e)[0];i=r.createElement(e);i.async=!0;i.src=t;l.parentNode.insertBefore(i,l)})(window,document,'script','https://collector.retailcrm.pro/w.js','_rc');
|
||||
_rc('create', '" . $key . "', " . json_encode((object) $params) . ");
|
||||
_rc('create', '" . $keys[SITE_ID] . "', " . json_encode((object) $params) . ");
|
||||
_rc('send', 'pageView');
|
||||
</script>";
|
||||
//тут добавить подключение доп. файла с другими возможностями коллектора
|
||||
$APPLICATION->AddHeadString($str, true);
|
||||
} else {
|
||||
return false;
|
||||
|
|
|
@ -131,8 +131,11 @@
|
|||
"type": "string"
|
||||
},
|
||||
"managerId": {
|
||||
"type": "int"
|
||||
}
|
||||
"type": "int"
|
||||
},
|
||||
"browserId": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"orders": {
|
||||
"number": {
|
||||
|
@ -202,6 +205,9 @@
|
|||
"site": {
|
||||
"type": "string"
|
||||
},
|
||||
"countryIso": {
|
||||
"type": "string"
|
||||
},
|
||||
"call": {
|
||||
"type": "bool",
|
||||
"default": false
|
||||
|
@ -406,6 +412,15 @@
|
|||
},
|
||||
"shipmentStore": {
|
||||
"type": "string"
|
||||
},
|
||||
"from": {
|
||||
"type": "skip"
|
||||
},
|
||||
"to": {
|
||||
"type": "skip"
|
||||
},
|
||||
"custom": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
|
@ -48,29 +48,7 @@ class RetailCrmEvent
|
|||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* onBeforeOrderAdd
|
||||
*
|
||||
* @param mixed $arFields - User arFields
|
||||
*/
|
||||
// function onBeforeOrderAdd($arFields = array()) {
|
||||
// $GLOBALS['RETAILCRM_ORDER_OLD_EVENT'] = false;
|
||||
// return;
|
||||
// }
|
||||
|
||||
/**
|
||||
* OnOrderSave
|
||||
*
|
||||
* @param mixed $ID - Order id
|
||||
* @param mixed $arFields - Order arFields
|
||||
*/
|
||||
// function OnOrderSave($ID, $arFields, $arOrder, $isNew)
|
||||
// {
|
||||
// $GLOBALS['RETAILCRM_EVENT_OLD'] = true;
|
||||
// return;
|
||||
// }
|
||||
}
|
||||
|
||||
/**
|
||||
* onUpdateOrder
|
||||
|
|
|
@ -64,8 +64,8 @@ class RetailCrmHistory
|
|||
$log->write($customerH, 'customerHistory');
|
||||
|
||||
if (count($customerH) == 0) {
|
||||
if ($customerHistory['totalPageCount'] > $customerHistory['currentPage']) {
|
||||
$historyFilter['page'] = $customerHistory['currentPage'] + 1;
|
||||
if ($customerHistory['history']['totalPageCount'] > $customerHistory['history']['currentPage']) {
|
||||
$historyFilter['page'] = $customerHistory['history']['currentPage'] + 1;
|
||||
|
||||
continue;
|
||||
}
|
||||
|
@ -275,8 +275,8 @@ class RetailCrmHistory
|
|||
$log->write($orderH, 'orderHistory');
|
||||
|
||||
if (count($orderH) == 0) {
|
||||
if ($orderHistory['totalPageCount'] > $orderHistory['currentPage']) {
|
||||
$historyFilter['page'] = $orderHistory['currentPage'] + 1;
|
||||
if ($orderHistory['history']['totalPageCount'] > $orderHistory['history']['currentPage']) {
|
||||
$historyFilter['page'] = $orderHistory['history']['currentPage'] + 1;
|
||||
|
||||
continue;
|
||||
}
|
||||
|
@ -535,7 +535,7 @@ class RetailCrmHistory
|
|||
if (array_key_exists($key, $order)) {
|
||||
$somePropValue = $propertyCollection->getItemByOrderPropertyId($propsKey[$orderProp]['ID']);
|
||||
if ($key == 'fio') {
|
||||
self::setProp($somePropValue, $order[$key]);
|
||||
self::setProp($somePropValue, $order[$key]);
|
||||
} else {
|
||||
self::setProp($somePropValue, RCrmActions::fromJSON($order[$key]));
|
||||
}
|
||||
|
|
|
@ -64,8 +64,8 @@ class RetailCrmHistory
|
|||
$log->write($customerH, 'customerHistory');
|
||||
|
||||
if (count($customerH) == 0) {
|
||||
if ($customerHistory['totalPageCount'] > $customerHistory['currentPage']) {
|
||||
$historyFilter['page'] = $customerHistory['currentPage'] + 1;
|
||||
if ($customerHistory['history']['totalPageCount'] > $customerHistory['history']['currentPage']) {
|
||||
$historyFilter['page'] = $customerHistory['history']['currentPage'] + 1;
|
||||
|
||||
continue;
|
||||
}
|
||||
|
@ -270,8 +270,8 @@ class RetailCrmHistory
|
|||
$log->write($orderH, 'orderHistory');
|
||||
|
||||
if (count($orderH) == 0) {
|
||||
if ($orderHistory['totalPageCount'] > $orderHistory['currentPage']) {
|
||||
$historyFilter['page'] = $orderHistory['currentPage'] + 1;
|
||||
if ($orderHistory['history']['totalPageCount'] > $orderHistory['history']['currentPage']) {
|
||||
$historyFilter['page'] = $orderHistory['history']['currentPage'] + 1;
|
||||
|
||||
continue;
|
||||
}
|
||||
|
@ -549,7 +549,7 @@ class RetailCrmHistory
|
|||
if (array_key_exists($key, $order)) {
|
||||
$somePropValue = $propertyCollection->getItemByOrderPropertyId($propsKey[$orderProp]['ID']);
|
||||
if ($key == 'fio') {
|
||||
self::setProp($somePropValue, $order[$key]);
|
||||
self::setProp($somePropValue, $order[$key]);
|
||||
} else {
|
||||
self::setProp($somePropValue, RCrmActions::fromJSON($order[$key]));
|
||||
}
|
||||
|
|
|
@ -55,59 +55,59 @@ class RetailCrmICML
|
|||
|
||||
public function Load()
|
||||
{
|
||||
global $USER;
|
||||
if (!isset($_SESSION["SESS_AUTH"]["USER_ID"]) || !$_SESSION["SESS_AUTH"]["USER_ID"]) {
|
||||
$USER = new CUser;
|
||||
}
|
||||
global $USER;
|
||||
if (!isset($_SESSION["SESS_AUTH"]["USER_ID"]) || !$_SESSION["SESS_AUTH"]["USER_ID"]) {
|
||||
$USER = new CUser;
|
||||
}
|
||||
|
||||
$this->isLogged = true;
|
||||
$this->isLogged = true;
|
||||
|
||||
$defaultSite = CSite::GetList($by = "def", $order = "desc", array('DEF' => 'Y'))->Fetch();
|
||||
$this->encodingDefault = $defaultSite["CHARSET"];
|
||||
|
||||
$url = 'https://' . $this->serverName;
|
||||
$curlHandler = curl_init();
|
||||
curl_setopt($curlHandler, CURLOPT_URL, $url);
|
||||
$responseBody = curl_exec($curlHandler);
|
||||
$statusCode = curl_getinfo($curlHandler, CURLINFO_HTTP_CODE);
|
||||
curl_close($curlHandler);
|
||||
if ($statusCode == 200) {
|
||||
$this->protocol = 'https://';
|
||||
} else {
|
||||
$this->protocol = 'http://';
|
||||
}
|
||||
|
||||
$this->PrepareSettings();
|
||||
$defaultSite = CSite::GetList($by = "def", $order = "desc", array('DEF' => 'Y'))->Fetch();
|
||||
$this->encodingDefault = $defaultSite["CHARSET"];
|
||||
|
||||
$this->fp = $this->PrepareFile($this->filename. '.tmp');
|
||||
$url = 'https://' . $this->serverName;
|
||||
$curlHandler = curl_init();
|
||||
curl_setopt($curlHandler, CURLOPT_URL, $url);
|
||||
$responseBody = curl_exec($curlHandler);
|
||||
$statusCode = curl_getinfo($curlHandler, CURLINFO_HTTP_CODE);
|
||||
curl_close($curlHandler);
|
||||
if ($statusCode == 200) {
|
||||
$this->protocol = 'https://';
|
||||
} else {
|
||||
$this->protocol = 'http://';
|
||||
}
|
||||
|
||||
if ($this->isLogged) {
|
||||
$this->fpLog = $this->PrepareFile($this->logFile);
|
||||
$this->WriteLog("Start Loading");
|
||||
}
|
||||
$this->PrepareSettings();
|
||||
|
||||
$this->PreWriteCatalog();
|
||||
$this->fp = $this->PrepareFile($this->filename. '.tmp');
|
||||
|
||||
$categories = $this->GetCategories();
|
||||
if ($this->isLogged) {
|
||||
$this->fpLog = $this->PrepareFile($this->logFile);
|
||||
$this->WriteLog("Start Loading");
|
||||
}
|
||||
|
||||
$this->WriteCategories($categories);
|
||||
$this->PreWriteCatalog();
|
||||
|
||||
$this->PreWriteOffers();
|
||||
$this->BuildOffers($categories);
|
||||
$this->PostWriteOffers();
|
||||
$categories = $this->GetCategories();
|
||||
|
||||
$this->PostWriteCatalog();
|
||||
$this->WriteCategories($categories);
|
||||
|
||||
if ($this->isLogged) {
|
||||
$this->WriteLog("Loading was ended successfully (peek memory usage: " . memory_get_peak_usage() . ")");
|
||||
}
|
||||
$this->PreWriteOffers();
|
||||
$this->BuildOffers($categories);
|
||||
$this->PostWriteOffers();
|
||||
|
||||
$this->CloseFile($this->fp);
|
||||
$this->CloseFile($this->fpLog);
|
||||
unlink($defaultSite['ABS_DOC_ROOT'] . $this->filename);
|
||||
rename($defaultSite['ABS_DOC_ROOT'] . $this->filename. '.tmp', $defaultSite['ABS_DOC_ROOT'] . $this->filename);
|
||||
$this->PostWriteCatalog();
|
||||
|
||||
return true;
|
||||
if ($this->isLogged) {
|
||||
$this->WriteLog("Loading was ended successfully (peek memory usage: " . memory_get_peak_usage() . ")");
|
||||
}
|
||||
|
||||
$this->CloseFile($this->fp);
|
||||
$this->CloseFile($this->fpLog);
|
||||
unlink($defaultSite['ABS_DOC_ROOT'] . $this->filename);
|
||||
rename($defaultSite['ABS_DOC_ROOT'] . $this->filename. '.tmp', $defaultSite['ABS_DOC_ROOT'] . $this->filename);
|
||||
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
|
@ -136,49 +136,48 @@ class RetailCrmICML
|
|||
|
||||
protected function PrepareFile($filename)
|
||||
{
|
||||
$fullFilename = $_SERVER["DOCUMENT_ROOT"] . $filename;
|
||||
CheckDirPath($fullFilename);
|
||||
$fullFilename = $_SERVER["DOCUMENT_ROOT"] . $filename;
|
||||
CheckDirPath($fullFilename);
|
||||
|
||||
if ($fp = @fopen($fullFilename, "w")){
|
||||
return $fp;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
if ($fp = @fopen($fullFilename, "w")){
|
||||
return $fp;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
protected function PreWriteCatalog()
|
||||
{
|
||||
@fwrite($this->fp, "<yml_catalog date=\"" . $this->PrepareValue(Date("Y-m-d H:i:s")) . "\">\n
|
||||
<shop>\n
|
||||
<name>" . $this->PrepareValue(COption::GetOptionString("main", "site_name", ""))."</name>\n
|
||||
<company>" . $this->PrepareValue(COption::GetOptionString("main", "site_name", ""))."</company>\n"
|
||||
);
|
||||
|
||||
@fwrite($this->fp, "<yml_catalog date=\"" . $this->PrepareValue(Date("Y-m-d H:i:s")) . "\">\n
|
||||
<shop>\n
|
||||
<name>" . $this->PrepareValue(COption::GetOptionString("main", "site_name", ""))."</name>\n
|
||||
<company>" . $this->PrepareValue(COption::GetOptionString("main", "site_name", ""))."</company>\n"
|
||||
);
|
||||
}
|
||||
|
||||
protected function WriteCategories($categories)
|
||||
{
|
||||
$stringCategories = "";
|
||||
@fwrite($this->fp, "<categories>\n");
|
||||
foreach ($categories as $category) {
|
||||
$stringCategories .= $this->BuildCategory($category);
|
||||
}
|
||||
@fwrite($this->fp, $stringCategories);
|
||||
@fwrite($this->fp, "</categories>\n");
|
||||
$stringCategories = "";
|
||||
@fwrite($this->fp, "<categories>\n");
|
||||
foreach ($categories as $category) {
|
||||
$stringCategories .= $this->BuildCategory($category);
|
||||
}
|
||||
@fwrite($this->fp, $stringCategories);
|
||||
@fwrite($this->fp, "</categories>\n");
|
||||
}
|
||||
protected function PreWriteOffers()
|
||||
{
|
||||
@fwrite($this->fp, "<offers>\n");
|
||||
@fwrite($this->fp, "<offers>\n");
|
||||
}
|
||||
|
||||
protected function PostWriteOffers()
|
||||
protected function PostWriteOffers()
|
||||
{
|
||||
@fwrite($this->fp, "</offers>\n");
|
||||
@fwrite($this->fp, "</offers>\n");
|
||||
}
|
||||
|
||||
protected function WriteOffers($offers)
|
||||
protected function WriteOffers($offers)
|
||||
{
|
||||
@fwrite($this->fp, $offers);
|
||||
@fwrite($this->fp, $offers);
|
||||
}
|
||||
|
||||
protected function WriteLog($text)
|
||||
|
@ -190,53 +189,51 @@ class RetailCrmICML
|
|||
|
||||
protected function PostWriteCatalog()
|
||||
{
|
||||
@fwrite($this->fp, "</shop>\n
|
||||
</yml_catalog>\n");
|
||||
@fwrite($this->fp, "</shop>\n
|
||||
</yml_catalog>\n");
|
||||
}
|
||||
|
||||
protected function CloseFile($fp)
|
||||
{
|
||||
@fclose($fp);
|
||||
@fclose($fp);
|
||||
}
|
||||
|
||||
|
||||
protected function GetCategories()
|
||||
{
|
||||
$categories = array();
|
||||
foreach ($this->iblocks as $id) {
|
||||
$filter = array("IBLOCK_ID" => $id);
|
||||
$categories = array();
|
||||
foreach ($this->iblocks as $id) {
|
||||
$filter = array("IBLOCK_ID" => $id);
|
||||
|
||||
$dbRes = CIBlockSection::GetList(array("left_margin" => "asc"), $filter);
|
||||
$hasCategories = false;
|
||||
while ($arRes = $dbRes->Fetch()) {
|
||||
$categories[$arRes['ID']] = $arRes;
|
||||
$hasCategories = true;
|
||||
}
|
||||
if (!$hasCategories) {
|
||||
$iblock = CIBlock::GetByID($id)->Fetch();
|
||||
|
||||
$arRes = Array();
|
||||
$arRes['ID'] = $this->mainSection + $id;
|
||||
$arRes['IBLOCK_SECTION_ID'] = 0;
|
||||
$arRes['NAME'] = sprintf(GetMessage('ROOT_CATEGORY_FOR_CATALOG'), $iblock['NAME']);
|
||||
$categories[$arRes['ID']] = $arRes;
|
||||
}
|
||||
$dbRes = CIBlockSection::GetList(array("left_margin" => "asc"), $filter);
|
||||
$hasCategories = false;
|
||||
while ($arRes = $dbRes->Fetch()) {
|
||||
$categories[$arRes['ID']] = $arRes;
|
||||
$hasCategories = true;
|
||||
}
|
||||
|
||||
return $categories;
|
||||
if (!$hasCategories) {
|
||||
$iblock = CIBlock::GetByID($id)->Fetch();
|
||||
|
||||
$arRes = Array();
|
||||
$arRes['ID'] = $this->mainSection + $id;
|
||||
$arRes['IBLOCK_SECTION_ID'] = 0;
|
||||
$arRes['NAME'] = sprintf(GetMessage('ROOT_CATEGORY_FOR_CATALOG'), $iblock['NAME']);
|
||||
$categories[$arRes['ID']] = $arRes;
|
||||
}
|
||||
}
|
||||
|
||||
return $categories;
|
||||
}
|
||||
|
||||
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";
|
||||
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";
|
||||
|
||||
}
|
||||
|
||||
|
@ -271,7 +268,7 @@ class RetailCrmICML
|
|||
if ($this->propertiesProduct[$id][$key] != "") {
|
||||
$arSelect[] = "PROPERTY_" . $propProduct;
|
||||
$arSelect[] = "PROPERTY_" . $propProduct . ".NAME";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$arSelectOffer = array(
|
||||
|
|
|
@ -138,7 +138,7 @@ class RetailCrmInventories
|
|||
} while($dbResProductsIds->NavPageNomer < $dbResProductsIds->NavPageCount);
|
||||
}
|
||||
} else {
|
||||
RCrmActions::eventLog('RetailCrmInventories::inventoriesUpload()', '$shops', 'No iblocks selected');
|
||||
RCrmActions::eventLog('RetailCrmInventories::inventoriesUpload()', '$infoBlocks', 'No iblocks selected');
|
||||
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -157,11 +157,6 @@ class RetailCrmOrder
|
|||
$normalizer = new RestNormalizer();
|
||||
$order = $normalizer->normalize($order, 'orders');
|
||||
|
||||
if (isset($arParams['optionsSitesList']) && is_array($arParams['optionsSitesList']) &&
|
||||
array_key_exists($arFields['LID'], $arParams['optionsSitesList'])) {
|
||||
$site = $arParams['optionsSitesList'][$arFields['LID']];
|
||||
}
|
||||
|
||||
$log = new Logger();
|
||||
$log->write($order, 'order');
|
||||
|
||||
|
@ -316,7 +311,7 @@ class RetailCrmOrder
|
|||
'PERSON_TYPE_ID' => $obOrder->getPersonTypeId(),
|
||||
'CURRENCY' => $obOrder->getCurrency(),
|
||||
'PAYMENTS' => $obOrder->getPaymentSystemId(),
|
||||
'PAYED' => $obOrder->isPaid(),
|
||||
'PAYED' => $obOrder->isPaid() ? 'Y' : 'N',
|
||||
'DELIVERYS' => array(),
|
||||
'PRICE_DELIVERY' => $obOrder->getDeliveryPrice(),
|
||||
'PROPS' => $obOrder->getPropertyCollection()->getArray(),
|
||||
|
@ -324,6 +319,7 @@ class RetailCrmOrder
|
|||
'BASKET' => array(),
|
||||
'USER_DESCRIPTION' => $obOrder->getField('USER_DESCRIPTION'),
|
||||
'COMMENTS' => $obOrder->getField('COMMENTS'),
|
||||
'REASON_CANCELED' => $obOrder->getField('REASON_CANCELED'),
|
||||
);
|
||||
|
||||
$shipmentList = $obOrder->getShipmentCollection();
|
||||
|
|
|
@ -35,7 +35,7 @@ class RetailCrmOrder
|
|||
* @return array - array('order' = $order, 'customer' => $customer)
|
||||
*/
|
||||
public static function orderSend($arFields, $api, $arParams, $send = false, $site = null, $methodApi = 'ordersEdit')
|
||||
{
|
||||
{
|
||||
if (!$api || empty($arParams)) { // add cond to check $arParams
|
||||
return false;
|
||||
}
|
||||
|
@ -144,9 +144,11 @@ class RetailCrmOrder
|
|||
foreach ($arFields['PAYMENTS'] as $payment) {
|
||||
$pm = array(
|
||||
'type' => isset($arParams['optionsPayTypes'][$payment['PAY_SYSTEM_ID']]) ? $arParams['optionsPayTypes'][$payment['PAY_SYSTEM_ID']] : '',
|
||||
'externalId' => $payment['ID'],
|
||||
'amount' => $payment['SUM']
|
||||
);
|
||||
if (!empty($payment['ID'])) {
|
||||
$pm['externalId'] = $payment['ID'];
|
||||
}
|
||||
if (!empty($payment['DATE_PAID'])) {
|
||||
$pm['paidAt'] = new \DateTime($payment['DATE_PAID']);
|
||||
}
|
||||
|
@ -155,8 +157,9 @@ class RetailCrmOrder
|
|||
}
|
||||
$payments[] = $pm;
|
||||
}
|
||||
$order['payments'] = $payments;
|
||||
|
||||
if (count($payments) > 0) {
|
||||
$order['payments'] = $payments;
|
||||
}
|
||||
//отправка
|
||||
if (function_exists('retailCrmBeforeOrderSend')) {
|
||||
$newResOrder = retailCrmBeforeOrderSend($order, $arFields);
|
||||
|
@ -172,11 +175,6 @@ class RetailCrmOrder
|
|||
$normalizer = new RestNormalizer();
|
||||
$order = $normalizer->normalize($order, 'orders');
|
||||
|
||||
/*if (isset($arParams['optionsSitesList']) && is_array($arParams['optionsSitesList']) &&
|
||||
array_key_exists($arFields['LID'], $arParams['optionsSitesList'])) {
|
||||
$site = $arParams['optionsSitesList'][$arFields['LID']];
|
||||
}*/
|
||||
|
||||
$log = new Logger();
|
||||
$log->write($order, 'order');
|
||||
|
||||
|
@ -336,7 +334,11 @@ class RetailCrmOrder
|
|||
|
||||
if (count($resOrders) > 0) {
|
||||
foreach ($resCustomers as $key => $customerLoad) {
|
||||
$site = count($optionsSitesList) > 1 ? $optionsSitesList[$key] : null;
|
||||
if(array_key_exists($key, $optionsSitesList)) {
|
||||
$site = $optionsSitesList[$key];
|
||||
} else {
|
||||
$site = null;
|
||||
}
|
||||
if (RCrmActions::apiMethod($api, 'customersUpload', __METHOD__, $customerLoad, $site) === false) {
|
||||
return false;
|
||||
}
|
||||
|
@ -345,7 +347,11 @@ class RetailCrmOrder
|
|||
}
|
||||
}
|
||||
foreach ($resOrders as $key => $orderLoad) {
|
||||
$site = count($optionsSitesList) > 1 ? $optionsSitesList[$key] : null;
|
||||
if(array_key_exists($key, $optionsSitesList)) {
|
||||
$site = $optionsSitesList[$key];
|
||||
} else {
|
||||
$site = null;
|
||||
}
|
||||
if (RCrmActions::apiMethod($api, 'ordersUpload', __METHOD__, $orderLoad, $site) === false) {
|
||||
return false;
|
||||
}
|
||||
|
@ -382,6 +388,7 @@ class RetailCrmOrder
|
|||
'BASKET' => array(),
|
||||
'USER_DESCRIPTION' => $obOrder->getField('USER_DESCRIPTION'),
|
||||
'COMMENTS' => $obOrder->getField('COMMENTS'),
|
||||
'REASON_CANCELED' => $obOrder->getField('REASON_CANCELED'),
|
||||
);
|
||||
|
||||
$shipmentList = $obOrder->getShipmentCollection();
|
||||
|
|
|
@ -38,13 +38,13 @@ class RetailCrmPrices
|
|||
$shops = unserialize(COption::GetOptionString(self::$MODULE_ID, self::$CRM_PRICE_SHOPS, 0));
|
||||
|
||||
if (count($shops) == 0) {
|
||||
RCrmActions::eventLog('RetailCrmInventories::pricesUpload()', '$shops', 'No stores selected for download');
|
||||
RCrmActions::eventLog('RetailCrmPrices::pricesUpload()', '$shops', 'No stores selected for download');
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
if (count($prices) == 0) {
|
||||
RCrmActions::eventLog('RetailCrmInventories::pricesUpload()', '$prices', 'No prices selected for download');
|
||||
RCrmActions::eventLog('RetailCrmPrices::pricesUpload()', '$prices', 'No prices selected for download');
|
||||
|
||||
return false;
|
||||
}
|
||||
|
@ -127,9 +127,11 @@ class RetailCrmPrices
|
|||
} while($dbResProductsIds->NavPageNomer < $dbResProductsIds->NavPageCount);
|
||||
}
|
||||
} else {
|
||||
RCrmActions::eventLog('RetailCrmInventories::pricesUpload()', '$shops', 'No iblocks selected');
|
||||
RCrmActions::eventLog('RetailCrmPrices::pricesUpload()', '$infoBlocks', 'No iblocks selected');
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
return 'RetailCrmPrices::pricesUpload();';
|
||||
}
|
||||
}
|
|
@ -3,19 +3,18 @@ class RetailCrmUa
|
|||
{
|
||||
public static $MODULE_ID = 'intaro.retailcrm';
|
||||
public static $CRM_UA = 'ua';
|
||||
public static $CRM_UA_INDEX = 'ua_index';
|
||||
public static $CRM_UA_ID = 'ua_id';
|
||||
public static $CRM_UA_KEYS = 'ua_keys';
|
||||
|
||||
public static function add()
|
||||
{
|
||||
$ua = COption::GetOptionString(self::$MODULE_ID, self::$CRM_UA, 0);
|
||||
$uaIndex = COption::GetOptionString(self::$MODULE_ID, self::$CRM_UA_INDEX, 0);
|
||||
$uaId = COption::GetOptionString(self::$MODULE_ID, self::$CRM_UA_ID, 0);
|
||||
if ($ua === 'Y' && $uaIndex && $uaId && ADMIN_SECTION !== true) {
|
||||
$uaKeys = unserialize(COption::GetOptionString(self::$MODULE_ID, self::$CRM_UA_KEYS, 0));
|
||||
|
||||
if ($ua === 'Y' && !empty($uaKeys[SITE_ID]['ID']) && !empty($uaKeys[SITE_ID]['INDEX']) && ADMIN_SECTION !== true) {
|
||||
global $APPLICATION;
|
||||
|
||||
$ua = "
|
||||
<script>
|
||||
<script type=\"text/javascript\">
|
||||
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
|
||||
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
|
||||
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
|
||||
|
@ -29,15 +28,15 @@ class RetailCrmUa
|
|||
}
|
||||
ga('set', 'dimension" . $uaIndex . "', getRetailCrmCookie('_ga'));
|
||||
ga('send', 'pageview');
|
||||
";
|
||||
</script>";
|
||||
if (isset($_GET['ORDER_ID'])) {
|
||||
CModule::IncludeModule("sale");
|
||||
$arOrder = CSaleOrder::GetByID($_GET['ORDER_ID']);
|
||||
$ua .= "
|
||||
$ua .= "<script type=\"text/javascript\">
|
||||
ga('require', 'ecommerce', 'ecommerce.js');
|
||||
ga('ecommerce:addTransaction', {
|
||||
'id': $arOrder[ID],
|
||||
'affiliation': $_SERVER[SERVER_NAME],
|
||||
'affiliation': '$_SERVER[SERVER_NAME]',
|
||||
'revenue': $arOrder[PRICE],
|
||||
'tax': $arOrder[DISCOUNT_VALUE]
|
||||
});
|
||||
|
|
|
@ -96,10 +96,7 @@ if (file_exists($_SERVER["DOCUMENT_ROOT"]."/bitrix/php_interface/retailcrm/expor
|
|||
echo ShowError(implode('<br />', $arSetupErrors));
|
||||
|
||||
|
||||
if ($STEP==1)
|
||||
{
|
||||
|
||||
|
||||
if ($STEP==1) {
|
||||
?>
|
||||
|
||||
<style type="text/css">
|
||||
|
@ -179,86 +176,84 @@ if (file_exists($_SERVER["DOCUMENT_ROOT"]."/bitrix/php_interface/retailcrm/expor
|
|||
|
||||
while ($iblock = $db_res->Fetch())
|
||||
{
|
||||
if ($arCatalog = CCatalog::GetByIDExt($iblock["ID"]))
|
||||
if ($arCatalog = CCatalog::GetByIDExt($iblock["ID"]))
|
||||
{
|
||||
if($arCatalog['CATALOG_TYPE'] == "D" || $arCatalog['CATALOG_TYPE'] == "X" || $arCatalog['CATALOG_TYPE'] == "P")
|
||||
{
|
||||
if($arCatalog['CATALOG_TYPE'] == "D" || $arCatalog['CATALOG_TYPE'] == "X" || $arCatalog['CATALOG_TYPE'] == "P")
|
||||
{
|
||||
$propertiesSKU = null;
|
||||
if ($arCatalog['CATALOG_TYPE'] == "X" || $arCatalog['CATALOG_TYPE'] == "P")
|
||||
{
|
||||
$iblockOffer = CCatalogSKU::GetInfoByProductIBlock($iblock["ID"]);
|
||||
$propertiesSKU = null;
|
||||
if ($arCatalog['CATALOG_TYPE'] == "X" || $arCatalog['CATALOG_TYPE'] == "P")
|
||||
{
|
||||
$iblockOffer = CCatalogSKU::GetInfoByProductIBlock($iblock["ID"]);
|
||||
|
||||
$db_properties = CIBlock::GetProperties($iblockOffer['IBLOCK_ID'], Array());
|
||||
while($prop = $db_properties->Fetch())
|
||||
$propertiesSKU[] = $prop;
|
||||
$db_properties = CIBlock::GetProperties($iblockOffer['IBLOCK_ID'], Array());
|
||||
while($prop = $db_properties->Fetch())
|
||||
$propertiesSKU[] = $prop;
|
||||
|
||||
$oldPropertySKU = null;
|
||||
if (isset($IBLOCK_PROPERTY_SKU[$iblock['ID']])) {
|
||||
foreach ($iblockPropertiesName as $key => $prop) {
|
||||
$oldPropertySKU[$key] = $IBLOCK_PROPERTY_SKU[$iblock['ID']][$key];
|
||||
}
|
||||
}
|
||||
|
||||
$oldPropertyUnitSKU = null;
|
||||
if (isset($IBLOCK_PROPERTY_UNIT_SKU[$iblock['ID']])) {
|
||||
foreach ($iblockPropertiesName as $key => $prop) {
|
||||
$oldPropertyUnitSKU[$key] = $IBLOCK_PROPERTY_UNIT_SKU[$iblock['ID']][$key];
|
||||
}
|
||||
}
|
||||
$oldPropertySKU = null;
|
||||
if (isset($IBLOCK_PROPERTY_SKU[$iblock['ID']])) {
|
||||
foreach ($iblockPropertiesName as $key => $prop) {
|
||||
$oldPropertySKU[$key] = $IBLOCK_PROPERTY_SKU[$iblock['ID']][$key];
|
||||
}
|
||||
|
||||
|
||||
$propertiesProduct = null;
|
||||
$db_properties = CIBlock::GetProperties($iblock['ID'], Array());
|
||||
while($prop = $db_properties->Fetch())
|
||||
$propertiesProduct[] = $prop;
|
||||
|
||||
$oldPropertyProduct = null;
|
||||
if (isset($IBLOCK_PROPERTY_PRODUCT[$iblock['ID']])) {
|
||||
foreach ($iblockPropertiesName as $key => $prop) {
|
||||
$oldPropertyProduct[$key] = $IBLOCK_PROPERTY_PRODUCT[$iblock['ID']][$key];
|
||||
}
|
||||
}
|
||||
|
||||
$oldPropertyUnitProduct = null;
|
||||
if (isset($IBLOCK_PROPERTY_UNIT_PRODUCT[$iblock['ID']])) {
|
||||
foreach ($iblockPropertiesName as $key => $prop) {
|
||||
$oldPropertyUnitProduct[$key] = $IBLOCK_PROPERTY_UNIT_PRODUCT[$iblock['ID']][$key];
|
||||
}
|
||||
}
|
||||
|
||||
$arSiteList = array();
|
||||
$rsSites = CIBlock::GetSite($iblock["ID"]);
|
||||
while ($arSite = $rsSites->Fetch())
|
||||
{
|
||||
$arSiteList[] = $arSite["SITE_ID"];
|
||||
}
|
||||
|
||||
if (count($IBLOCK_EXPORT) != 0)
|
||||
$boolExport = (in_array($iblock['ID'], $IBLOCK_EXPORT));
|
||||
else
|
||||
$boolExport = true;
|
||||
|
||||
|
||||
$arIBlockList[] = array(
|
||||
'ID' => $iblock['ID'],
|
||||
'NAME' => $iblock['NAME'],
|
||||
'IBLOCK_TYPE_ID' => $iblock['IBLOCK_TYPE_ID'],
|
||||
'IBLOCK_EXPORT' => $boolExport,
|
||||
'PROPERTIES_SKU' => $propertiesSKU,
|
||||
'PROPERTIES_PRODUCT' => $propertiesProduct,
|
||||
'OLD_PROPERTY_SKU_SELECT' => $oldPropertySKU,
|
||||
'OLD_PROPERTY_UNIT_SKU_SELECT' => $oldPropertyUnitSKU,
|
||||
'OLD_PROPERTY_PRODUCT_SELECT' => $oldPropertyProduct,
|
||||
'OLD_PROPERTY_UNIT_PRODUCT_SELECT' => $oldPropertyUnitProduct,
|
||||
'SITE_LIST' => '('.implode(' ',$arSiteList).')',
|
||||
);
|
||||
|
||||
if ($boolExport)
|
||||
$intCountChecked++;
|
||||
$intCountAvailIBlock++;
|
||||
}
|
||||
|
||||
$oldPropertyUnitSKU = null;
|
||||
if (isset($IBLOCK_PROPERTY_UNIT_SKU[$iblock['ID']])) {
|
||||
foreach ($iblockPropertiesName as $key => $prop) {
|
||||
$oldPropertyUnitSKU[$key] = $IBLOCK_PROPERTY_UNIT_SKU[$iblock['ID']][$key];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$propertiesProduct = null;
|
||||
$db_properties = CIBlock::GetProperties($iblock['ID'], Array());
|
||||
while($prop = $db_properties->Fetch())
|
||||
$propertiesProduct[] = $prop;
|
||||
|
||||
$oldPropertyProduct = null;
|
||||
if (isset($IBLOCK_PROPERTY_PRODUCT[$iblock['ID']])) {
|
||||
foreach ($iblockPropertiesName as $key => $prop) {
|
||||
$oldPropertyProduct[$key] = $IBLOCK_PROPERTY_PRODUCT[$iblock['ID']][$key];
|
||||
}
|
||||
}
|
||||
|
||||
$oldPropertyUnitProduct = null;
|
||||
if (isset($IBLOCK_PROPERTY_UNIT_PRODUCT[$iblock['ID']])) {
|
||||
foreach ($iblockPropertiesName as $key => $prop) {
|
||||
$oldPropertyUnitProduct[$key] = $IBLOCK_PROPERTY_UNIT_PRODUCT[$iblock['ID']][$key];
|
||||
}
|
||||
}
|
||||
|
||||
$arSiteList = array();
|
||||
$rsSites = CIBlock::GetSite($iblock["ID"]);
|
||||
while ($arSite = $rsSites->Fetch())
|
||||
{
|
||||
$arSiteList[] = $arSite["SITE_ID"];
|
||||
}
|
||||
|
||||
if (count($IBLOCK_EXPORT) != 0)
|
||||
$boolExport = (in_array($iblock['ID'], $IBLOCK_EXPORT));
|
||||
else
|
||||
$boolExport = true;
|
||||
|
||||
$arIBlockList[] = array(
|
||||
'ID' => $iblock['ID'],
|
||||
'NAME' => $iblock['NAME'],
|
||||
'IBLOCK_TYPE_ID' => $iblock['IBLOCK_TYPE_ID'],
|
||||
'IBLOCK_EXPORT' => $boolExport,
|
||||
'PROPERTIES_SKU' => $propertiesSKU,
|
||||
'PROPERTIES_PRODUCT' => $propertiesProduct,
|
||||
'OLD_PROPERTY_SKU_SELECT' => $oldPropertySKU,
|
||||
'OLD_PROPERTY_UNIT_SKU_SELECT' => $oldPropertyUnitSKU,
|
||||
'OLD_PROPERTY_PRODUCT_SELECT' => $oldPropertyProduct,
|
||||
'OLD_PROPERTY_UNIT_PRODUCT_SELECT' => $oldPropertyUnitProduct,
|
||||
'SITE_LIST' => '('.implode(' ',$arSiteList).')',
|
||||
);
|
||||
|
||||
if ($boolExport)
|
||||
$intCountChecked++;
|
||||
$intCountAvailIBlock++;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (count($IBLOCK_EXPORT) != 0) {
|
||||
if ($intCountChecked == $intCountAvailIBlock)
|
||||
|
@ -267,7 +262,6 @@ if (file_exists($_SERVER["DOCUMENT_ROOT"]."/bitrix/php_interface/retailcrm/expor
|
|||
$intCountChecked = $intCountAvailIBlock;
|
||||
$boolAll = true;
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
<font class="text" style="font-weight: bold;"><?=GetMessage("CHECK_ALL_INFOBLOCKS");?></font>
|
||||
|
@ -317,7 +311,6 @@ if (file_exists($_SERVER["DOCUMENT_ROOT"]."/bitrix/php_interface/retailcrm/expor
|
|||
<tbody>
|
||||
|
||||
<? foreach ($iblockPropertiesName as $key => $property): ?>
|
||||
|
||||
<? $productSelected = false;?>
|
||||
|
||||
<tr class="adm-list-table-row">
|
||||
|
@ -696,7 +689,6 @@ if (file_exists($_SERVER["DOCUMENT_ROOT"]."/bitrix/php_interface/retailcrm/expor
|
|||
elseif ($STEP==2)
|
||||
{
|
||||
COption::SetOptionString($MODULE_ID, $CRM_CATALOG_BASE_PRICE . '_' . $_REQUEST['PROFILE_ID'], htmlspecialchars(trim($_POST['price-types'])));
|
||||
COption::SetOptionString($MODULE_ID, 'catalog_base_iblocks', serialize($IBLOCK_EXPORT));
|
||||
$FINITE = true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -44,7 +44,7 @@ class intaro_retailcrm extends CModule
|
|||
var $CRM_ORDER_HISTORY = 'order_history';
|
||||
var $CRM_CUSTOMER_HISTORY = 'customer_history';
|
||||
var $CRM_CATALOG_BASE_PRICE = 'catalog_base_price';
|
||||
var $CRM_CATALOG_IBLOCKS = 'catalog_base_iblocks';
|
||||
//var $CRM_CATALOG_IBLOCKS = 'catalog_base_iblocks';
|
||||
var $CRM_ORDER_NUMBERS = 'order_numbers';
|
||||
var $CRM_CANSEL_ORDER = 'cansel_order';
|
||||
|
||||
|
@ -62,8 +62,7 @@ class intaro_retailcrm extends CModule
|
|||
var $CRM_COLL_KEY = 'coll_key';
|
||||
|
||||
var $CRM_UA = 'ua';
|
||||
var $CRM_UA_INDEX = 'ua_index';
|
||||
var $CRM_UA_ID = 'ua_id';
|
||||
var $CRM_UA_KEYS = 'ua_keys';
|
||||
|
||||
var $CRM_API_VERSION = 'api_version';
|
||||
|
||||
|
@ -112,7 +111,6 @@ class intaro_retailcrm extends CModule
|
|||
}
|
||||
}
|
||||
|
||||
//запилить проверку на версию api
|
||||
include($this->INSTALL_PATH . '/../classes/general/Http/Client.php');
|
||||
include($this->INSTALL_PATH . '/../classes/general/Response/ApiResponse.php');
|
||||
include($this->INSTALL_PATH . '/../classes/general/RCrmActions.php');
|
||||
|
@ -243,6 +241,8 @@ class intaro_retailcrm extends CModule
|
|||
$APPLICATION->IncludeAdminFile(
|
||||
GetMessage('MODULE_INSTALL_TITLE'), $this->INSTALL_PATH . '/step1.php'
|
||||
);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
COption::SetOptionString($this->MODULE_ID, $this->CRM_API_HOST_OPTION, $api_host);
|
||||
|
@ -255,7 +255,7 @@ class intaro_retailcrm extends CModule
|
|||
$APPLICATION->IncludeAdminFile(
|
||||
GetMessage('MODULE_INSTALL_TITLE'), $this->INSTALL_PATH . '/step11.php'
|
||||
);
|
||||
} else if ($step == 2) {//<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
} else if ($step == 2) {//доставки, оплаты, типы заказов
|
||||
if (!CModule::IncludeModule("sale")) {
|
||||
$arResult['errCode'] = 'ERR_SALE';
|
||||
}
|
||||
|
@ -282,8 +282,8 @@ class intaro_retailcrm extends CModule
|
|||
$api_key = COption::GetOptionString($this->MODULE_ID, $this->CRM_API_KEY_OPTION, 0);
|
||||
|
||||
foreach ($arResult['arSites'] as $site) {
|
||||
if ($_POST['sites-id-'.$site['LID']] && !empty($_POST['sites-id-'.$site['LID']])) {
|
||||
$siteCode[$site['LID']] = htmlspecialchars(trim($_POST['sites-id-'.$site['LID']]));
|
||||
if ($_POST['sites-id-' . $site['LID']] && !empty($_POST['sites-id-' . $site['LID']])) {
|
||||
$siteCode[$site['LID']] = htmlspecialchars(trim($_POST['sites-id-' . $site['LID']]));
|
||||
}
|
||||
}
|
||||
if (count($arResult['arSites']) != count($siteCode)) {
|
||||
|
@ -291,6 +291,7 @@ class intaro_retailcrm extends CModule
|
|||
$APPLICATION->IncludeAdminFile(
|
||||
GetMessage('MODULE_INSTALL_TITLE'), $this->INSTALL_PATH . '/step11.php'
|
||||
);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -310,8 +311,9 @@ class intaro_retailcrm extends CModule
|
|||
if (!$api_host || !$api_key) {
|
||||
$arResult['errCode'] = 'ERR_FIELDS_API_HOST';
|
||||
$APPLICATION->IncludeAdminFile(
|
||||
GetMessage('MODULE_INSTALL_TITLE'), $this->INSTALL_PATH . '/step1.php'
|
||||
GetMessage('MODULE_INSTALL_TITLE'), $this->INSTALL_PATH . '/step1.php'
|
||||
);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -323,6 +325,8 @@ class intaro_retailcrm extends CModule
|
|||
$APPLICATION->IncludeAdminFile(
|
||||
GetMessage('MODULE_INSTALL_TITLE'), $this->INSTALL_PATH . '/step1.php'
|
||||
);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
COption::SetOptionString($this->MODULE_ID, $this->CRM_API_HOST_OPTION, $api_host);
|
||||
|
@ -627,6 +631,7 @@ class intaro_retailcrm extends CModule
|
|||
|
||||
$customerH = self::historyLoad($api, 'customersHistory');
|
||||
COption::SetOptionString($this->MODULE_ID, $this->CRM_CUSTOMER_HISTORY, $customerH);
|
||||
|
||||
//если есть старое значение, переделываем его на новый лад, иначе вычисляем
|
||||
if ($historyDate = COption::GetOptionString($this->OLD_MODULE_ID, 'order_history_date', 0)) {
|
||||
try {
|
||||
|
@ -653,12 +658,25 @@ class intaro_retailcrm extends CModule
|
|||
} else {
|
||||
$orderH = self::historyLoad($api, 'ordersHistory');
|
||||
}
|
||||
|
||||
|
||||
COption::SetOptionString($this->MODULE_ID, $this->CRM_ORDER_HISTORY, $orderH);
|
||||
|
||||
|
||||
if ($orderLastId = COption::GetOptionString($this->OLD_MODULE_ID, $this->CRM_ORDER_LAST_ID, 0)) {
|
||||
COption::SetOptionString($this->MODULE_ID, $this->CRM_ORDER_LAST_ID, $orderLastId);
|
||||
} else {
|
||||
$dbOrder = \Bitrix\Sale\Internals\OrderTable::GetList(array(
|
||||
'order' => array("ID" => "DESC"),
|
||||
'limit' => 1,
|
||||
'select' => array('ID')
|
||||
));
|
||||
$arOrder = $dbOrder->fetch();
|
||||
if (!empty($arOrder['ID'])) {
|
||||
COption::SetOptionString($this->MODULE_ID, $this->CRM_ORDER_LAST_ID, $arOrder['ID']);
|
||||
} else {
|
||||
COption::SetOptionString($this->MODULE_ID, $this->CRM_ORDER_LAST_ID, 0);
|
||||
}
|
||||
}
|
||||
|
||||
if ($orderFailedIds = COption::GetOptionString($this->OLD_MODULE_ID, $this->CRM_ORDER_FAILED_IDS, 0)) {
|
||||
COption::SetOptionString($this->MODULE_ID, $this->CRM_ORDER_FAILED_IDS, $orderFailedIds);
|
||||
}
|
||||
|
@ -791,7 +809,7 @@ class intaro_retailcrm extends CModule
|
|||
RegisterModuleDependences("sale", "OnSaleOrderEntityDelete", $this->MODULE_ID, "RetailCrmEvent", "orderDelete");
|
||||
|
||||
COption::SetOptionString($this->MODULE_ID, $this->CRM_CATALOG_BASE_PRICE, htmlspecialchars(trim($_POST['price-types'])));
|
||||
COption::SetOptionString($this->MODULE_ID, $this->CRM_CATALOG_IBLOCKS, $iblocks);
|
||||
//COption::SetOptionString($this->MODULE_ID, $this->CRM_CATALOG_IBLOCKS, $iblocks);
|
||||
|
||||
COption::SetOptionString($this->MODULE_ID, $this->CRM_INVENTORIES_UPLOAD, 'N');
|
||||
COption::SetOptionString($this->MODULE_ID, $this->CRM_PRICES_UPLOAD, 'N');
|
||||
|
@ -966,7 +984,7 @@ class intaro_retailcrm extends CModule
|
|||
COption::RemoveOption($this->MODULE_ID, $this->CRM_CUSTOMER_HISTORY);
|
||||
COption::RemoveOption($this->MODULE_ID, $this->CRM_ORDER_HISTORY);
|
||||
COption::RemoveOption($this->MODULE_ID, $this->CRM_CATALOG_BASE_PRICE);
|
||||
COption::RemoveOption($this->MODULE_ID, $this->CRM_CATALOG_IBLOCKS);
|
||||
//COption::RemoveOption($this->MODULE_ID, $this->CRM_CATALOG_IBLOCKS);
|
||||
COption::RemoveOption($this->MODULE_ID, $this->CRM_ORDER_NUMBERS);
|
||||
COption::RemoveOption($this->MODULE_ID, $this->CRM_CANSEL_ORDER);
|
||||
|
||||
|
@ -984,8 +1002,7 @@ class intaro_retailcrm extends CModule
|
|||
COption::RemoveOption($this->MODULE_ID, $this->CRM_COLL_KEY);
|
||||
|
||||
COption::RemoveOption($this->MODULE_ID, $this->CRM_UA);
|
||||
COption::RemoveOption($this->MODULE_ID, $this->CRM_UA_INDEX);
|
||||
COption::RemoveOption($this->MODULE_ID, $this->CRM_UA_ID);
|
||||
COption::RemoveOption($this->MODULE_ID, $this->CRM_UA_KEYS);
|
||||
|
||||
COption::RemoveOption($this->MODULE_ID, $this->CRM_API_VERSION);
|
||||
|
||||
|
@ -1067,41 +1084,60 @@ class intaro_retailcrm extends CModule
|
|||
function historyLoad($api, $method)
|
||||
{
|
||||
$page = null;
|
||||
$i = 0;
|
||||
while (true) {
|
||||
$i++;
|
||||
try {
|
||||
$history = $api->$method(array(), $page);
|
||||
} catch (\RetailCrm\Exception\CurlException $e) {
|
||||
RCrmActions::eventLog(
|
||||
'RetailCrmHistory::' . $method, 'RetailCrm\RestApi::' . $method . '::CurlException',
|
||||
$e->getCode() . ': ' . $e->getMessage()
|
||||
);
|
||||
$end['id'] = 0;
|
||||
$end['id'] = 0;
|
||||
|
||||
return $end['id'];
|
||||
} catch (InvalidArgumentException $e) {
|
||||
RCrmActions::eventLog(
|
||||
'RetailCrmHistory::' . $method, 'RetailCrm\RestApi::' . $method . '::InvalidArgumentException',
|
||||
$e->getCode() . ': ' . $e->getMessage()
|
||||
);
|
||||
$end['id'] = 0;
|
||||
try {
|
||||
$history = $api->$method(array(), $page);
|
||||
} catch (\RetailCrm\Exception\CurlException $e) {
|
||||
RCrmActions::eventLog(
|
||||
'RetailCrmHistory::' . $method, 'RetailCrm\RestApi::' . $method . '::CurlException',
|
||||
$e->getCode() . ': ' . $e->getMessage()
|
||||
);
|
||||
|
||||
return $end['id'];
|
||||
return $end['id'];
|
||||
} catch (InvalidArgumentException $e) {
|
||||
RCrmActions::eventLog(
|
||||
'RetailCrmHistory::' . $method, 'RetailCrm\RestApi::' . $method . '::InvalidArgumentException',
|
||||
$e->getCode() . ': ' . $e->getMessage()
|
||||
);
|
||||
|
||||
return $end['id'];
|
||||
}
|
||||
if ($history['pagination']['totalPageCount'] > $history['pagination']['currentPage']) {
|
||||
$page = $history['pagination']['totalPageCount'];
|
||||
while (true) {
|
||||
try {
|
||||
$history = $api->$method(array(), $page);
|
||||
} catch (\RetailCrm\Exception\CurlException $e) {
|
||||
RCrmActions::eventLog(
|
||||
'RetailCrmHistory::' . $method, 'RetailCrm\RestApi::' . $method . '::CurlException',
|
||||
$e->getCode() . ': ' . $e->getMessage()
|
||||
);
|
||||
|
||||
return $end['id'];
|
||||
} catch (InvalidArgumentException $e) {
|
||||
RCrmActions::eventLog(
|
||||
'RetailCrmHistory::' . $method, 'RetailCrm\RestApi::' . $method . '::InvalidArgumentException',
|
||||
$e->getCode() . ': ' . $e->getMessage()
|
||||
);
|
||||
|
||||
return $end['id'];
|
||||
}
|
||||
|
||||
if (isset($history['history'])) {
|
||||
$end = array_pop($history['history']);
|
||||
|
||||
break;
|
||||
} else {
|
||||
$page--;
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($history['history'])) {
|
||||
} else {
|
||||
if (isset($history['history']) && count($history['history']) > 0) {
|
||||
$end = array_pop($history['history']);
|
||||
} else {
|
||||
$end['id'] = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
if ($history['pagination']['totalPageCount'] == $history['pagination']['currentPage']) {
|
||||
break;
|
||||
}
|
||||
|
||||
$page = $history['pagination']['totalPageCount'];
|
||||
}
|
||||
|
||||
return $end['id'];
|
||||
|
@ -1110,7 +1146,7 @@ class intaro_retailcrm extends CModule
|
|||
function ping($api_host, $api_key)
|
||||
{
|
||||
global $APPLICATION;
|
||||
include($this->INSTALL_PATH . '/../classes/general/Http/Client.php');
|
||||
|
||||
$versions = array('v5', 'v4');
|
||||
foreach ($versions as $version) {
|
||||
$client = new RetailCrm\Http\Client($api_host . '/api/' . $version, array('apiKey' => $api_key));
|
||||
|
|
|
@ -13,7 +13,7 @@ $MESS ['CANCELED'] = 'Является флагом «Отменен»';
|
|||
$MESS ['INFO_1'] = 'Задайте соответствие между справочниками 1C-Битрикс и справочниками retailCRM.';
|
||||
$MESS ['INFO_2'] = 'В случае, если вы не нашли подходящих значений в справочниках retailCRM, вы можете внести их в разделе';
|
||||
$MESS ['URL_1'] = 'Администрирование';
|
||||
$MESS ['INFO_3'] = 'После этого подгрузите новые значения, нажав кнопку «Обновить справочники»';
|
||||
$MESS ['INFO_3'] = 'После этого подгрузите новые значения обновив страницу';
|
||||
$MESS ['UPDATE_CATS'] = 'Обновить справочники';
|
||||
$MESS ['MESS_5'] = 'Произошла ошибка сервера, обратитесь в Интаро Софт.';
|
||||
$MESS ['DELIV_TYPES_EXPORT'] = 'Выгрузить список доставок из 1С-Битрикс';
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
$MESS ['INTAROCRM_INFO'] = '
|
||||
<h2>Дальнейшие действия<h2>
|
||||
<h2>Дальнейшие действия</h2>
|
||||
<p>
|
||||
Если вы произвели выгрузку заказов на шаге 3, то эти заказы уже доступны в вашей CRM и
|
||||
через некоторое время по этим заказам будет подготовлены аналитические отчеты в Панели KPI.
|
||||
|
|
|
@ -82,7 +82,7 @@ $MESS ['PRICE_TYPES'] = 'Выгружаемые типы цен';
|
|||
$MESS ['SHOPS_PRICES_UPLOAD'] = 'Магазины в которые будут грузиться дополнительные типы цен';
|
||||
|
||||
$MESS ['DEMON_COLLECTOR'] = 'Активировать Демон Collector';
|
||||
$MESS ['DEMON_KEY'] = 'Ключ сайта:';
|
||||
$MESS ['DEMON_KEY'] = 'Ключ для';
|
||||
|
||||
$MESS ['UNIVERSAL_ANALYTICS'] = 'Включить интеграцию с UA';
|
||||
$MESS ['ID_UA'] = 'Идентификатор отслеживания:';
|
||||
|
|
|
@ -36,8 +36,7 @@ $CRM_COLLECTOR = 'collector';
|
|||
$CRM_COLL_KEY = 'coll_key';
|
||||
|
||||
$CRM_UA = 'ua';
|
||||
$CRM_UA_INDEX = 'ua_index';
|
||||
$CRM_UA_ID = 'ua_id';
|
||||
$CRM_UA_KEYS = 'ua_keys';
|
||||
|
||||
$CRM_API_VERSION = 'api_version';
|
||||
|
||||
|
@ -324,7 +323,7 @@ if (isset($_POST['Update']) && ($_POST['Update'] == 'Y')) {
|
|||
$bitrixStoresArr = array();
|
||||
$bitrixShopsArr = array();
|
||||
$bitrixIblocksInventories = array();
|
||||
if(htmlspecialchars(trim($_POST['inventories-upload']))){
|
||||
if(htmlspecialchars(trim($_POST['inventories-upload'])) == 'Y'){
|
||||
$inventoriesUpload = 'Y';
|
||||
$dateAgent = new DateTime();
|
||||
$intAgent = new DateInterval('PT60S'); // PT60S - 60 sec;
|
||||
|
@ -362,7 +361,7 @@ if (isset($_POST['Update']) && ($_POST['Update'] == 'Y')) {
|
|||
//prices
|
||||
$bitrixPricesArr = array();
|
||||
$bitrixIblocksPrices = array();
|
||||
if(htmlspecialchars(trim($_POST['prices-upload']))){
|
||||
if(htmlspecialchars(trim($_POST['prices-upload'])) == 'Y'){
|
||||
$pricesUpload = 'Y';
|
||||
|
||||
$dateAgent = new DateTime();
|
||||
|
@ -399,9 +398,13 @@ if (isset($_POST['Update']) && ($_POST['Update'] == 'Y')) {
|
|||
}
|
||||
|
||||
//demon
|
||||
if(htmlspecialchars(trim($_POST['collector']))){
|
||||
if (htmlspecialchars(trim($_POST['collector'])) == 'Y') {
|
||||
$collector = 'Y';
|
||||
$collectorKey = trim($_POST['collector-id']);
|
||||
$collectorKeys = array();
|
||||
foreach ($arResult['arSites'] as $site) {
|
||||
$collectorKeys[$site['LID']] = trim($_POST['collector-id-' . $site['LID']]);
|
||||
}
|
||||
//$collectorKey = trim($_POST['collector-id']);
|
||||
RegisterModuleDependences("main", "OnBeforeProlog", $mid, "RetailCrmCollector", "add");
|
||||
} else {
|
||||
$collector = 'N';
|
||||
|
@ -409,10 +412,15 @@ if (isset($_POST['Update']) && ($_POST['Update'] == 'Y')) {
|
|||
}
|
||||
|
||||
//UA
|
||||
if(htmlspecialchars(trim($_POST['ua-integration']))){
|
||||
if (htmlspecialchars(trim($_POST['ua-integration'])) == 'Y') {
|
||||
$ua = 'Y';
|
||||
$uaId = trim($_POST['ua-id']);
|
||||
$uaIndex = trim($_POST['ua-index']);
|
||||
$uaKeys = array();
|
||||
foreach ($arResult['arSites'] as $site) {
|
||||
$uaKeys[$site['LID']]['ID'] = trim($_POST['ua-id-' . $site['LID']]);
|
||||
$uaKeys[$site['LID']]['INDEX'] = trim($_POST['ua-index-' . $site['LID']]);
|
||||
}
|
||||
// $uaId = trim($_POST['ua-id']);
|
||||
// $uaIndex = trim($_POST['ua-index']);
|
||||
RegisterModuleDependences("main", "OnBeforeProlog", $mid, "RetailCrmUa", "add");
|
||||
} else {
|
||||
$ua = 'N';
|
||||
|
@ -482,11 +490,11 @@ if (isset($_POST['Update']) && ($_POST['Update'] == 'Y')) {
|
|||
COption::SetOptionString($mid, $CRM_IBLOCKS_PRICES, serialize(RCrmActions::clearArr($bitrixIblocksPrices)));
|
||||
|
||||
COption::SetOptionString($mid, $CRM_COLLECTOR, $collector);
|
||||
COption::SetOptionString($mid, $CRM_COLL_KEY, $collectorKey);
|
||||
COption::SetOptionString($mid, $CRM_COLL_KEY, serialize(RCrmActions::clearArr($collectorKeys)));
|
||||
|
||||
COption::SetOptionString($mid, $CRM_UA, $ua);
|
||||
COption::SetOptionString($mid, $CRM_UA_INDEX, $uaIndex);
|
||||
COption::SetOptionString($mid, $CRM_UA_ID, $uaId);
|
||||
COption::SetOptionString($mid, $CRM_UA_KEYS, serialize(RCrmActions::clearArr($uaKeys)));
|
||||
//COption::SetOptionString($mid, $CRM_UA_ID, $uaId);
|
||||
|
||||
$uri .= '&ok=Y';
|
||||
LocalRedirect($uri);
|
||||
|
@ -577,11 +585,10 @@ if (isset($_POST['Update']) && ($_POST['Update'] == 'Y')) {
|
|||
$optionIblocksPrices = unserialize(COption::GetOptionString($mid, $CRM_IBLOCKS_PRICES, 0));
|
||||
|
||||
$optionCollector = COption::GetOptionString($mid, $CRM_COLLECTOR, 0);
|
||||
$optionCollectorKey = COption::GetOptionString($mid, $CRM_COLL_KEY);
|
||||
$optionCollectorKeys = unserialize(COption::GetOptionString($mid, $CRM_COLL_KEY));
|
||||
|
||||
$optionUa = COption::GetOptionString($mid, $CRM_UA, 0);
|
||||
$optionUaIndex = COption::GetOptionString($mid, $CRM_UA_INDEX);
|
||||
$optionUaId = COption::GetOptionString($mid, $CRM_UA_ID);
|
||||
$optionUaKeys = unserialize(COption::GetOptionString($mid, $CRM_UA_KEYS));
|
||||
|
||||
$version = COption::GetOptionString($mid, $CRM_API_VERSION, 0);
|
||||
|
||||
|
@ -734,6 +741,13 @@ if (isset($_POST['Update']) && ($_POST['Update'] == 'Y')) {
|
|||
.option-other-empty{
|
||||
border-bottom: 15px solid #f5f9f9 !important;
|
||||
}
|
||||
.option-head{
|
||||
text-align: center;
|
||||
padding: 10px;
|
||||
font-size: 14px;
|
||||
color: #4b6267;
|
||||
}
|
||||
|
||||
</style>
|
||||
<form method="POST" action="<?php echo $uri; ?>" id="FORMACTION">
|
||||
<?php
|
||||
|
@ -777,7 +791,7 @@ if (isset($_POST['Update']) && ($_POST['Update'] == 'Y')) {
|
|||
<?php if(!$badKey):?>
|
||||
<?php $tabControl->BeginNextTab(); ?>
|
||||
<input type="hidden" name="tab" value="catalog">
|
||||
<tr align="center">
|
||||
<tr class="option-head">
|
||||
<td colspan="2"><b><?php echo GetMessage('INFO_1'); ?></b></td>
|
||||
</tr>
|
||||
<tr class="heading">
|
||||
|
@ -920,10 +934,7 @@ if (isset($_POST['Update']) && ($_POST['Update'] == 'Y')) {
|
|||
<?php endforeach; ?>
|
||||
<?php $tabControl->BeginNextTab(); ?>
|
||||
<input type="hidden" name="tab" value="catalog">
|
||||
<tr class="heading">
|
||||
<td colspan="2"><b><?php echo GetMessage('ORDER_PROPS'); ?></b></td>
|
||||
</tr>
|
||||
<tr align="center">
|
||||
<tr class="option-head">
|
||||
<td colspan="2"><b><?php echo GetMessage('INFO_2'); ?></b></td>
|
||||
</tr>
|
||||
<?php foreach($arResult['bitrixOrderTypesList'] as $bitrixOrderType): ?>
|
||||
|
@ -1028,15 +1039,15 @@ if (isset($_POST['Update']) && ($_POST['Update'] == 'Y')) {
|
|||
<tr class="heading">
|
||||
<td colspan="2" class="option-other-bottom"><b><?php echo GetMessage('ORDERS_OPTIONS'); ?></b></td>
|
||||
</tr>
|
||||
<tr class="heading">
|
||||
<td colspan="2" class="option-other-top option-other-bottom">
|
||||
<tr>
|
||||
<td colspan="2" class="option-head option-other-top option-other-bottom">
|
||||
<b>
|
||||
<label><input class="addr" type="checkbox" name="order-numbers" value="Y" <?php if($optionsOrderNumbers == 'Y') echo "checked"; ?>> <?php echo GetMessage('ORDER_NUMBERS'); ?></label>
|
||||
</b>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="heading">
|
||||
<td colspan="2" class="option-other-top option-other-bottom">
|
||||
<tr>
|
||||
<td colspan="2" class="option-head option-other-top option-other-bottom">
|
||||
<b>
|
||||
<label><input class="addr" type="radio" name="order-discharge" value="0" <?php if($optionsDischarge == 0) echo "checked"; ?>><?php echo GetMessage('DISCHARGE_AGENT'); ?></label>
|
||||
<label><input class="addr" type="radio" name="order-discharge" value="1" <?php if($optionsDischarge == 1) echo "checked"; ?>><?php echo GetMessage('DISCHARGE_EVENTS'); ?></label>
|
||||
|
@ -1046,8 +1057,8 @@ if (isset($_POST['Update']) && ($_POST['Update'] == 'Y')) {
|
|||
<tr class="heading" >
|
||||
<td colspan="2" class="option-other-heading"><b><?php echo GetMessage('CRM_API_VERSION'); ?></b></td>
|
||||
</tr>
|
||||
<tr class="heading">
|
||||
<td colspan="2" class="option-other-top option-other-bottom">
|
||||
<tr>
|
||||
<td colspan="2" class="option-head option-other-top option-other-bottom">
|
||||
<select name="api_version" class="typeselect">
|
||||
<?php for($v = 4; $v <= 5; $v++) {
|
||||
$ver = 'v' . $v; ?>
|
||||
|
@ -1066,9 +1077,9 @@ if (isset($_POST['Update']) && ($_POST['Update'] == 'Y')) {
|
|||
</b>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="heading inventories" <?php if($optionInventotiesUpload !== 'Y') echo 'style="display: none;"'; ?>>
|
||||
<td colspan="2" class="option-other-top option-other-bottom">
|
||||
<label><?php echo GetMessage('INVENTORIES'); ?></label>
|
||||
<tr class="inventories" <?php if($optionInventotiesUpload !== 'Y') echo 'style="display: none;"'; ?>>
|
||||
<td colspan="2" class="option-head option-other-top option-other-bottom">
|
||||
<b><label><?php echo GetMessage('INVENTORIES'); ?></label></b>
|
||||
</td>
|
||||
</tr>
|
||||
<?php foreach ($arResult['bitrixStoresExportList'] as $catalogExportStore): ?>
|
||||
|
@ -1084,8 +1095,8 @@ if (isset($_POST['Update']) && ($_POST['Update'] == 'Y')) {
|
|||
</td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
<tr class="heading inventories" <?php if($optionInventotiesUpload !== 'Y') echo 'style="display: none;"'; ?>>
|
||||
<td colspan="2" class="option-other-top option-other-bottom">
|
||||
<tr class="inventories" <?php if($optionInventotiesUpload !== 'Y') echo 'style="display: none;"'; ?>>
|
||||
<td colspan="2" class="option-head option-other-top option-other-bottom">
|
||||
<b>
|
||||
<label><?php echo GetMessage('SHOPS_INVENTORIES_UPLOAD'); ?></label>
|
||||
</b>
|
||||
|
@ -1098,8 +1109,8 @@ if (isset($_POST['Update']) && ($_POST['Update'] == 'Y')) {
|
|||
</td>
|
||||
</tr>
|
||||
<?php endforeach;?>
|
||||
<tr class="heading inventories" <?php if($optionInventotiesUpload !== 'Y') echo 'style="display: none;"'; ?>>
|
||||
<td colspan="2" class="option-other-top option-other-bottom">
|
||||
<tr class="inventories" <?php if($optionInventotiesUpload !== 'Y') echo 'style="display: none;"'; ?>>
|
||||
<td colspan="2" class="option-head option-other-top option-other-bottom">
|
||||
<b>
|
||||
<label><?php echo GetMessage('IBLOCKS_UPLOAD'); ?></label>
|
||||
</b>
|
||||
|
@ -1121,8 +1132,8 @@ if (isset($_POST['Update']) && ($_POST['Update'] == 'Y')) {
|
|||
</b>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="heading prices" <?php if($optionPricesUpload !== 'Y') echo 'style="display: none;"'; ?>>
|
||||
<td colspan="2" class="option-other-top option-other-bottom">
|
||||
<tr class="prices" <?php if($optionPricesUpload !== 'Y') echo 'style="display: none;"'; ?>>
|
||||
<td colspan="2" class="option-head option-other-top option-other-bottom">
|
||||
<b>
|
||||
<label><?php echo GetMessage('PRICE_TYPES'); ?></label>
|
||||
</b>
|
||||
|
@ -1141,8 +1152,8 @@ if (isset($_POST['Update']) && ($_POST['Update'] == 'Y')) {
|
|||
</td>
|
||||
</tr>
|
||||
<?php endforeach;?>
|
||||
<tr class="heading prices" <?php if($optionPricesUpload !== 'Y') echo 'style="display: none;"'; ?>>
|
||||
<td colspan="2" class="option-other-top option-other-bottom">
|
||||
<tr class="prices" <?php if($optionPricesUpload !== 'Y') echo 'style="display: none;"'; ?>>
|
||||
<td colspan="2" class="option-head option-other-top option-other-bottom">
|
||||
<b>
|
||||
<label><?php echo GetMessage('SHOPS_PRICES_UPLOAD'); ?></label>
|
||||
</b>
|
||||
|
@ -1155,8 +1166,8 @@ if (isset($_POST['Update']) && ($_POST['Update'] == 'Y')) {
|
|||
</td>
|
||||
</tr>
|
||||
<?php endforeach;?>
|
||||
<tr class="heading prices" <?php if($optionPricesUpload !== 'Y') echo 'style="display: none;"'; ?>>
|
||||
<td colspan="2" class="option-other-top option-other-bottom">
|
||||
<tr class="prices" <?php if($optionPricesUpload !== 'Y') echo 'style="display: none;"'; ?>>
|
||||
<td colspan="2" class="option-head option-other-top option-other-bottom">
|
||||
<b>
|
||||
<label><?php echo GetMessage('IBLOCKS_UPLOAD'); ?></label>
|
||||
</b>
|
||||
|
@ -1178,32 +1189,45 @@ if (isset($_POST['Update']) && ($_POST['Update'] == 'Y')) {
|
|||
</b>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="r-coll">
|
||||
<td class="option-head" colspan="2">
|
||||
<b><?php echo GetMessage('ICRM_SITES'); ?></b>
|
||||
</td>
|
||||
</tr>
|
||||
<?php foreach ($arResult['arSites'] as $sitesList): ?>
|
||||
<tr class="r-coll" <?php if($optionCollector !== 'Y') echo 'style="display: none;"'; ?>>
|
||||
<td class="adm-detail-content-cell-l" width="50%"><?php echo GetMessage('DEMON_KEY'); ?></td>
|
||||
<td class="adm-detail-content-cell-l" width="50%"><?php echo GetMessage('DEMON_KEY'); ?> <?php echo $sitesList['NAME']; ?> (<?php echo $sitesList['LID']; ?>)</td>
|
||||
<td class="adm-detail-content-cell-r" width="50%">
|
||||
<input name="collector-id" value="<?php echo $optionCollectorKey; ?>" type="text">
|
||||
<input name="collector-id-<?echo $sitesList['LID'];?>" value="<?php echo $optionCollectorKeys[$sitesList['LID']]; ?>" type="text">
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<?php endforeach;?>
|
||||
<tr class="heading r-ua-button">
|
||||
<td colspan="2" class="option-other-heading">
|
||||
<b>
|
||||
<label><input class="addr" type="checkbox" name="ua-integration" value="Y" <?php if($optionUa === 'Y') echo "checked"; ?>><?php echo GetMessage('UNIVERSAL_ANALYTICS'); ?></label>
|
||||
</b>
|
||||
</td>
|
||||
</tr>
|
||||
</tr>
|
||||
<?php foreach ($arResult['arSites'] as $sitesList): ?>
|
||||
<tr class="r-ua">
|
||||
<td class="option-head" colspan="2">
|
||||
<b><?php echo $sitesList['NAME']; ?> (<?php echo $sitesList['LID']; ?>)</b>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="r-ua" <?php if($optionUa !== 'Y') echo 'style="display: none;"'; ?>>
|
||||
<td class="adm-detail-content-cell-l" width="50%"><?php echo GetMessage('ID_UA'); ?></td>
|
||||
<td class="adm-detail-content-cell-r" width="50%">
|
||||
<input name="ua-id" value="<?php echo $optionUaIndex; ?>" type="text">
|
||||
<input name="ua-id-<?echo $sitesList['LID'];?>" value="<?php echo $optionUaKeys[$sitesList['LID']]['ID']; ?>" type="text">
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="r-ua" <?php if($optionUa !== 'Y') echo 'style="display: none;"'; ?>>
|
||||
<td class="adm-detail-content-cell-l" width="50%"><?php echo GetMessage('INDEX_UA'); ?></td>
|
||||
<td class="adm-detail-content-cell-r" width="50%">
|
||||
<input name="ua-index" value="<?php echo $optionUaId; ?>" type="text">
|
||||
<input name="ua-index-<?echo $sitesList['LID'];?>" value="<?php echo $optionUaKeys[$sitesList['LID']]['INDEX']; ?>" type="text">
|
||||
</td>
|
||||
</tr>
|
||||
<?php endforeach;?>
|
||||
<?php endif;?>
|
||||
<?php $tabControl->Buttons(); ?>
|
||||
<input type="hidden" name="Update" value="Y" />
|
||||
|
|
|
@ -12,4 +12,6 @@ COption::SetOptionString($mid, $CRM_INVENTORIES_UPLOAD, 'N');
|
|||
COption::SetOptionString($mid, $CRM_PRICES_UPLOAD, 'N');
|
||||
COption::SetOptionString($mid, $CRM_COLLECTOR, 'N');
|
||||
COption::SetOptionString($mid, $CRM_UA, 'N');
|
||||
COption::SetOptionString($mid, $CRM_API_VERSION, 'v4');
|
||||
COption::SetOptionString($mid, $CRM_API_VERSION, 'v4');
|
||||
|
||||
COption::RemoveOption($mid, 'catalog_base_iblocks');
|
Loading…
Add table
Reference in a new issue