CDN correct url in icml
This commit is contained in:
commit
1d2a9dca82
@ -1,3 +1,8 @@
|
|||||||
|
## 2021-01-14 v.5.6.2
|
||||||
|
* Исправлено формирование картинок в ICML при включеном CDN
|
||||||
|
* Убрана некорректная запись внешнего идентификатора платежа для новых платежей по истории
|
||||||
|
* Добавлена проверка на длину email при отправке в систему
|
||||||
|
|
||||||
## 2020-12-15 v.5.6.1
|
## 2020-12-15 v.5.6.1
|
||||||
* Обновлено наименование бренда
|
* Обновлено наименование бренда
|
||||||
|
|
||||||
|
@ -257,11 +257,11 @@ class RetailCrmICML
|
|||||||
. "<name>" . $this->PrepareValue($arCategory["NAME"]) . "</name>\n";
|
. "<name>" . $this->PrepareValue($arCategory["NAME"]) . "</name>\n";
|
||||||
|
|
||||||
if (CFile::GetPath($arCategory["DETAIL_PICTURE"])) {
|
if (CFile::GetPath($arCategory["DETAIL_PICTURE"])) {
|
||||||
$category .= "\t<picture>" . $arCategory['SITE'] . CFile::GetPath($arCategory["DETAIL_PICTURE"]) . "</picture>\n";
|
$category .= "\t<picture>" . $this->getImageUrl($arCategory["DETAIL_PICTURE"]) . "</picture>\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
if (CFile::GetPath($arCategory["PICTURE"])) {
|
if (CFile::GetPath($arCategory["PICTURE"])) {
|
||||||
$category .= "\t<picture>" . $arCategory['SITE'] . CFile::GetPath($arCategory["PICTURE"]) . "</picture>\n";
|
$category .= "\t<picture>" . $this->getImageUrl($arCategory["PICTURE"]) . "</picture>\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
$category .= "</category>\n";
|
$category .= "</category>\n";
|
||||||
@ -421,16 +421,15 @@ class RetailCrmICML
|
|||||||
$offer['DETAIL_PAGE_URL'] = $product["DETAIL_PAGE_URL"];
|
$offer['DETAIL_PAGE_URL'] = $product["DETAIL_PAGE_URL"];
|
||||||
|
|
||||||
if (CFile::GetPath($offer["DETAIL_PICTURE"])) {
|
if (CFile::GetPath($offer["DETAIL_PICTURE"])) {
|
||||||
$offer['PICTURE'] = $this->protocol . $this->serverName . CFile::GetPath($offer["DETAIL_PICTURE"]);
|
$offer['PICTURE'] = $this->getImageUrl($offer["DETAIL_PICTURE"]);
|
||||||
} elseif (CFile::GetPath($offer["PREVIEW_PICTURE"])){
|
} elseif (CFile::GetPath($offer["PREVIEW_PICTURE"])) {
|
||||||
$offer['PICTURE'] = $this->protocol . $this->serverName . CFile::GetPath($offer["PREVIEW_PICTURE"]);
|
$offer['PICTURE'] = $this->getImageUrl($offer["PREVIEW_PICTURE"]);
|
||||||
} elseif (
|
} elseif (
|
||||||
$this->skuPictures
|
$this->skuPictures
|
||||||
&& isset($this->skuPictures[$iblockId])
|
&& isset($this->skuPictures[$iblockId])
|
||||||
&& CFile::GetPath($offer["PROPERTY_" . $this->skuPictures[$iblockId]['picture'] . "_VALUE"])
|
&& CFile::GetPath($offer["PROPERTY_" . $this->skuPictures[$iblockId]['picture'] . "_VALUE"])
|
||||||
) {
|
) {
|
||||||
$picture = CFile::GetPath($offer["PROPERTY_" . $this->skuPictures[$iblockId]['picture'] . "_VALUE"]);
|
$offer['PICTURE'] = $this->getImageUrl($offer["PROPERTY_" . $this->skuPictures[$iblockId]['picture'] . "_VALUE"]);
|
||||||
$offer['PICTURE'] = $this->protocol . $this->serverName . $picture;
|
|
||||||
} else {
|
} else {
|
||||||
$offer['PICTURE'] = $product['PICTURE'];
|
$offer['PICTURE'] = $product['PICTURE'];
|
||||||
}
|
}
|
||||||
@ -502,16 +501,15 @@ class RetailCrmICML
|
|||||||
$picture = '';
|
$picture = '';
|
||||||
|
|
||||||
if (CFile::GetPath($product["DETAIL_PICTURE"])) {
|
if (CFile::GetPath($product["DETAIL_PICTURE"])) {
|
||||||
$picture = $this->protocol . $this->serverName . CFile::GetPath($product["DETAIL_PICTURE"]);
|
$picture = $this->getImageUrl($product["DETAIL_PICTURE"]);
|
||||||
} elseif (CFile::GetPath($product["PREVIEW_PICTURE"])){
|
} elseif (CFile::GetPath($product["PREVIEW_PICTURE"])){
|
||||||
$picture= $this->protocol . $this->serverName . CFile::GetPath($product["PREVIEW_PICTURE"]);
|
$picture = $this->getImageUrl($product["PREVIEW_PICTURE"]);
|
||||||
} elseif (
|
} elseif (
|
||||||
$this->productPictures
|
$this->productPictures
|
||||||
&& isset($this->productPictures[$iblockId])
|
&& isset($this->productPictures[$iblockId])
|
||||||
&& CFile::GetPath($product["PROPERTY_" . $this->productPictures[$iblockId]['picture'] . "_VALUE"])
|
&& CFile::GetPath($product["PROPERTY_" . $this->productPictures[$iblockId]['picture'] . "_VALUE"])
|
||||||
) {
|
) {
|
||||||
$file = CFile::GetPath($product["PROPERTY_" . $this->productPictures[$iblockId]['picture'] . "_VALUE"]);
|
$picture = $this->getImageUrl($product["PROPERTY_" . $this->productPictures[$iblockId]['picture'] . "_VALUE"]);
|
||||||
$picture = $this->protocol . $this->serverName . $file;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return $picture;
|
return $picture;
|
||||||
@ -894,4 +892,20 @@ class RetailCrmICML
|
|||||||
"picture" => GetMessage("PROPERTY_PICTURE_HEADER_NAME")
|
"picture" => GetMessage("PROPERTY_PICTURE_HEADER_NAME")
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param $fileId
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getImageUrl($fileId)
|
||||||
|
{
|
||||||
|
$pathImage = CFile::GetPath($fileId);
|
||||||
|
$validation = "/^(http|https):\/\/([A-Z0-9][A-Z0-9_-]*(?:\.[A-Z0-9][A-Z0-9_-]*)+):?(\d+)?\/?/i";
|
||||||
|
|
||||||
|
if ((bool)preg_match($validation, $pathImage) === false) {
|
||||||
|
return $this->protocol . $this->serverName . $pathImage;
|
||||||
|
} else {
|
||||||
|
return $pathImage;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -1 +1,3 @@
|
|||||||
- Обновлено наименование бренда
|
- Исправлено формирование картинок в ICML при включеном CDN
|
||||||
|
- Убрана некорректная запись внешнего идентификатора платежа для новых платежей по истории
|
||||||
|
- Добавлена проверка на длину email при отправке в систему
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
<?
|
<?
|
||||||
$arModuleVersion = array(
|
$arModuleVersion = array(
|
||||||
"VERSION" => "5.6.1",
|
"VERSION" => "5.6.2",
|
||||||
"VERSION_DATE" => "2020-12-15 12:00:00"
|
"VERSION_DATE" => "2021-01-14 16:00:00"
|
||||||
);
|
);
|
||||||
|
@ -31,4 +31,10 @@ if (!IsModuleInstalled('intaro.retailcrm')) {
|
|||||||
COption::SetOptionString('intaro.retailcrm', 'api_version', 'v5');
|
COption::SetOptionString('intaro.retailcrm', 'api_version', 'v5');
|
||||||
CModule::IncludeModule('intaro.retailcrm');
|
CModule::IncludeModule('intaro.retailcrm');
|
||||||
|
|
||||||
|
CModule::IncludeModule("main");
|
||||||
|
global $DB;
|
||||||
|
$strSql = "INSERT INTO b_file (TIMESTAMP_X, MODULE_ID, HEIGHT, WIDTH, FILE_SIZE, CONTENT_TYPE, SUBDIR, FILE_NAME, ORIGINAL_NAME, DESCRIPTION, HANDLER_ID, EXTERNAL_ID)
|
||||||
|
VALUES ('2020-05-08 19:04:03', 'iblock', '500', '500', '23791', 'image/jpeg', 'iblock/c44', 'test.jpg', '788c4cf58bd93a5f75f2e3f2034023db.jpg', '', '', 'c570f175b3f74ccfa62c4a10d8e44b5c');";
|
||||||
|
$DB->Query($strSql);
|
||||||
|
|
||||||
require_once 'BitrixTestCase.php';
|
require_once 'BitrixTestCase.php';
|
||||||
|
37
tests/classes/general/icml/RetailCrmICMLTest.php
Normal file
37
tests/classes/general/icml/RetailCrmICMLTest.php
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class RetailCrmOrderTest
|
||||||
|
*/
|
||||||
|
use \Bitrix\Main\Loader;
|
||||||
|
|
||||||
|
class RetailCrmICMLTest extends BitrixTestCase
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @inheritdoc
|
||||||
|
*/
|
||||||
|
public function setUp()
|
||||||
|
{
|
||||||
|
parent::setUp();
|
||||||
|
COption::SetOptionString('intaro.retailcrm', 'api_version', 'v5');
|
||||||
|
CModule::IncludeModule('intaro.retailcrm');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testModuleInstalled()
|
||||||
|
{
|
||||||
|
$this->assertTrue(Loader::includeModule("intaro.retailcrm"));
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testGetImageUrl()
|
||||||
|
{
|
||||||
|
$test = new RetailCrmICML();
|
||||||
|
$result = $test->getImageUrl(1);
|
||||||
|
|
||||||
|
if (!empty($result)) {
|
||||||
|
$this->assertIsString($result);
|
||||||
|
$this->assertEquals("/upload/iblock/c44/test.jpg", $result);
|
||||||
|
} else {
|
||||||
|
$this->assertEmpty($result);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user