This commit is contained in:
parent
453bc495c0
commit
ee6d654d8c
@ -1,3 +1,6 @@
|
|||||||
|
## 2024-06-04 v.6.5.17
|
||||||
|
- Добавлена передача признака маркировки товара в ICML каталоге
|
||||||
|
|
||||||
## 2024-04-27 v.6.5.16
|
## 2024-04-27 v.6.5.16
|
||||||
- Обновлены аннотации в коде модуля
|
- Обновлены аннотации в коде модуля
|
||||||
|
|
||||||
|
@ -1 +1 @@
|
|||||||
- Обновлены аннотации в коде модуля
|
- Добавлена передача признака маркировки товара в ICML каталоге
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
$arModuleVersion = [
|
$arModuleVersion = [
|
||||||
'VERSION' => '6.5.16',
|
'VERSION' => '6.5.17',
|
||||||
'VERSION_DATE' => '2024-04-27 14:00:00'
|
'VERSION_DATE' => '2024-06-04 12:00:00'
|
||||||
];
|
];
|
||||||
|
@ -157,6 +157,7 @@ class IcmlWriter
|
|||||||
$this->writeSimpleElement('name', $offer->name);
|
$this->writeSimpleElement('name', $offer->name);
|
||||||
$this->writeSimpleElement('productName', $offer->productName);
|
$this->writeSimpleElement('productName', $offer->productName);
|
||||||
$this->writeSimpleElement('xmlId', $offer->xmlId);
|
$this->writeSimpleElement('xmlId', $offer->xmlId);
|
||||||
|
$this->writeSimpleElement('markable', $offer->markable);
|
||||||
$this->writeOptionalSimpleElement('vendor', $offer->vendor);
|
$this->writeOptionalSimpleElement('vendor', $offer->vendor);
|
||||||
$this->writeOptionalSimpleElement('barcode', $offer->barcode);
|
$this->writeOptionalSimpleElement('barcode', $offer->barcode);
|
||||||
$this->writeOptionalSimpleElement('vatRate', $offer->vatRate);
|
$this->writeOptionalSimpleElement('vatRate', $offer->vatRate);
|
||||||
|
@ -3,8 +3,12 @@
|
|||||||
namespace Intaro\RetailCrm\Icml;
|
namespace Intaro\RetailCrm\Icml;
|
||||||
|
|
||||||
use Bitrix\Catalog\ProductTable;
|
use Bitrix\Catalog\ProductTable;
|
||||||
|
use Bitrix\Highloadblock\HighloadBlockTable;
|
||||||
|
use Bitrix\Iblock;
|
||||||
use Bitrix\Main\ArgumentException;
|
use Bitrix\Main\ArgumentException;
|
||||||
use Intaro\RetailCrm\Component\ServiceLocator;
|
use Bitrix\Main\Entity;
|
||||||
|
use Bitrix\Main\Loader;
|
||||||
|
use Bitrix\Main\UserField\Internal\UserFieldHelper;
|
||||||
use Intaro\RetailCrm\Icml\Utils\IcmlUtils;
|
use Intaro\RetailCrm\Icml\Utils\IcmlUtils;
|
||||||
use Intaro\RetailCrm\Model\Bitrix\Orm\CatalogIblockInfo;
|
use Intaro\RetailCrm\Model\Bitrix\Orm\CatalogIblockInfo;
|
||||||
use Intaro\RetailCrm\Model\Bitrix\Xml\OfferParam;
|
use Intaro\RetailCrm\Model\Bitrix\Xml\OfferParam;
|
||||||
@ -116,6 +120,10 @@ class XmlOfferBuilder
|
|||||||
$this->vatRates = $this->settingsService->vatRates;
|
$this->vatRates = $this->settingsService->vatRates;
|
||||||
$this->measures = $this->prepareMeasures($measure);
|
$this->measures = $this->prepareMeasures($measure);
|
||||||
$this->serverName = $serverName;
|
$this->serverName = $serverName;
|
||||||
|
|
||||||
|
Loader::includeModule("highloadblock");
|
||||||
|
Loader::includeModule('iblock');
|
||||||
|
Loader::includeModule('catalog');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -262,6 +270,7 @@ class XmlOfferBuilder
|
|||||||
$this->xmlOffer->vatRate = $this->getVatRate($item);
|
$this->xmlOffer->vatRate = $this->getVatRate($item);
|
||||||
$this->xmlOffer->unitCode = $this->getUnitCode($item['CATALOG_MEASURE'], $item['ID']);
|
$this->xmlOffer->unitCode = $this->getUnitCode($item['CATALOG_MEASURE'], $item['ID']);
|
||||||
$this->xmlOffer->activity = $item['ACTIVE'];
|
$this->xmlOffer->activity = $item['ACTIVE'];
|
||||||
|
$this->xmlOffer->markable = $this->isMarkableOffer($item['ID']);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -565,4 +574,31 @@ class XmlOfferBuilder
|
|||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Метод для проверки можно ли маркировать товар.
|
||||||
|
*
|
||||||
|
* Таблица в БД - b_hlsys_marking_code_group
|
||||||
|
* По умолчанию ID Highload-блока ProductMarkingCodeGroup - 1.
|
||||||
|
*
|
||||||
|
* @param $offerId
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
private function isMarkableOffer($offerId): ?string
|
||||||
|
{
|
||||||
|
$idHlBlock = 1;
|
||||||
|
$hlBlock = HighloadBlockTable::getById($idHlBlock)->fetch();
|
||||||
|
$hlBlockData = HighloadBlockTable::compileEntity($hlBlock)->getDataClass();
|
||||||
|
$userFieldManager = UserFieldHelper::getInstance()->getManager();
|
||||||
|
$userFieldsData = $userFieldManager->GetUserFields(ProductTable::getUfId(), $offerId);
|
||||||
|
$ufProductGroup = $userFieldsData['UF_PRODUCT_GROUP']['VALUE'] ?? null;
|
||||||
|
$isMarkableOffer = null;
|
||||||
|
|
||||||
|
if ($ufProductGroup !== null) {
|
||||||
|
$productGroup = $hlBlockData::getList(["select" => ["UF_NAME"], "filter" => ['ID' => $ufProductGroup]]);
|
||||||
|
$isMarkableOffer = !empty($productGroup->Fetch()['UF_NAME']) ? 'Y' : 'N';
|
||||||
|
}
|
||||||
|
|
||||||
|
return $isMarkableOffer;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -140,6 +140,8 @@ class XmlOffer
|
|||||||
*/
|
*/
|
||||||
public ?string $activityProduct = null;
|
public ?string $activityProduct = null;
|
||||||
|
|
||||||
|
public ?string $markable = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param $productValue
|
* @param $productValue
|
||||||
* @param $offerValue
|
* @param $offerValue
|
||||||
|
Loading…
Reference in New Issue
Block a user