<? if (!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED !== true) die();
use Brather\SiteCore\Core;
use Bitrix\Highloadblock as HL;
use Brather\SiteCore\Tools\DataAlteration;
/**
* @var array $arParams
* @var array $arResult
* @var SaleOrderAjax $component
*/
CModule::IncludeModule('iblock');
CModule::IncludeModule('highloadblock');
$hlblock = HL\HighloadBlockTable::getById(Core::HLBLOCK_ID_COLOR_REFERENCE)->fetch();
$entity = HL\HighloadBlockTable::compileEntity($hlblock);
$entityDataClass = $entity->getDataClass();
foreach ($arResult['JS_DATA']['GRID']['ROWS'] as &$product) {
$productIds[] = $product['data']['PRODUCT_ID'];
$product['data']['PROPS'] = DataAlteration::arrangeByKey($product['data']['PROPS'], 'CODE');
}
$filter = ['ID' => $productIds, 'IBLOCK_ID' => Core::IBLOCK_CODE_CATALOG_OFFERS];
$offers = CIBlockElement::GetList(
[], $filter, false, false, ['*', 'PROPERTY_MY_OFFERS']
);
while($offer = $offers->GetNext()) {
$tempOffer[$offer['ID']] = $offer['PROPERTY_MY_OFFERS_VALUE'];
$tempOffer[$offer['ID']] = $offer['PROPERTY_MY_OFFERS_VALUE'];
}
$result = $entityDataClass::getList(array(
"select" => array("*"),
"order" => array("ID"=>"DESC"),
"filter" => Array("UF_XML_ID"=>$tempOffer),
));
while ($arRow = $result->Fetch()) {
$resized = CFile::ResizeImageGet(
$arRow['UF_FILE'],
['width' => 102, 'height' => 102],
\BX_RESIZE_IMAGE_EXACT,
false
);
$files[$arRow['UF_NAME']] = $resized['src'];
}
foreach ($arResult['JS_DATA']['GRID']['ROWS'] as &$product) {
$product['data']['PROPS']['MY_OFFERS']['PICTURE_SRC'] = $files[$product['data']['PROPS']['MY_OFFERS']['VALUE']];
}
$component = $this->__component;
$component::scaleImages($arResult['JS_DATA'], $arParams['SERVICES_IMAGES_SCALING']);