$arParams = $component->applyTemplateModifications();
foreach($arResult['OFFERS'] as $key => $offer) {
$colors = $arResult['SKU_PROPS'][$colorPropertyCode]['VALUES'];
$offerColorXmlId = $offer['PROPERTIES'][$colorPropertyCode]['VALUE'];
$offerColorImage = [];
// добавь и покажи что выведется
echo '<pre> $colors <br>';
print_r($colors);
echo '</pre>';
echo '<pre> $offerColorXmlId <br>';
print_r($offerColorXmlId);
echo '</pre>';
// ................
if($arResult['OFFERS']) {
$colorPropertyCode = 'COLOR_REF';
foreach($arResult['OFFERS'] as $key => $offer) {
$colors = $arResult['SKU_PROPS'][$colorPropertyCode]['VALUES'];
$offerColorXmlId = $offer['PROPERTIES'][$colorPropertyCode]['VALUE'];
$offerColorImage = [];
foreach($colors as $color) {
if($color['XML_ID'] == $offerColorXmlId) {
if(is_array($color['PICT']) && $color['PICT']['SRC']) {
$offerColorImage = $color['PICT'];
}
break;
}
}
if($offerColorImage) {
++$arResult['OFFERS'][$key]['MORE_PHOTO_COUNT'];
array_unshift($arResult['OFFERS'][$key]['MORE_PHOTO'], $offerColorImage);
++$arResult['JS_OFFERS'][$key]['SLIDER_COUNT'];
array_unshift($arResult['JS_OFFERS'][$key]['SLIDER'], $offerColorImage);
}
}
}
просто с точки зрения юзера или ленивого менеджера я хотел упростить систему до минимума