• Как вывести свойства товаров связанных "Привязкой к элементам" в Битрикс?

    msn0y
    @msn0y Автор вопроса
    Пару часов назад все сделал и верстал визуализацию, если понадобится кому-то:
    $TPcolorsList = array();
    $arResult['CATALOG_TP_COLOR'] = array();
    $arSelect = array("IBLOCK_ID", "ID", "NAME", "DETAIL_PAGE_URL", "QUANTITY", "PROPERTY_*");
    $arFilter = Array("IBLOCK_ID" => 5, "ID" => $arResult['PROPERTIES']['CATALOG_TP_COLOR']['VALUE']);
    
    $colors = HighloadBlockTable::getList(array("filter" => array('TABLE_NAME' => "bxready_color")))->fetch();
    $restp = CIBlockElement::GetList(array(), $arFilter, false, array("nPageSize" => 10), $arSelect);
    while ($ob = $restp->GetNextElement()) {
        $arFields = $ob->GetFields();
        $TPcolorsList[$arFields['ID']]['NAME'] = $arFields['NAME'];
        $TPcolorsList[$arFields['ID']]['DETAIL_PAGE_URL'] = $arFields['DETAIL_PAGE_URL'];
        $TPcolorsList[$arFields['ID']]['ID'] = $arFields['ID'];
        $TPcolorsList[$arFields['ID']]['QUANTITY'] = $arFields['QUANTITY'];
        $arProps = $ob->GetProperties();
        if (isset($colors['ID'])) {
            $entity = HighloadBlockTable::compileEntity($colors);
            $entity_data_class = $entity->getDataClass();
            $res = $entity_data_class::getList(array('filter' => ['=UF_XML_ID' => $arProps['COLOR']['VALUE']]));
            while ($item = $res->fetch()) {
                $TPcolorsList[$arFields['ID']]['COLOR'] = $item['UF_NAME'];
            }
        }
    }
    if (count($TPcolorsList) > 0) {
        $arResult['CATALOG_TP_COLOR'] = $TPcolorsList;
    }
    unset($colors);
    unset($TPcolorsList);
    unset($arSelect);
    unset($arFilter);
    unset($restp);
    Ответ написан
    Комментировать