Good day
Added to the product multiple property RELATED_PRODUCT
Please tell me how to get the values ​​of this multiple property for further work with them?

  • Refer to the official Bitrix manual, it is described there. - u_mulder
  • @ u_mulder - If you mean this: $ VALUES = array (); $ res = CIBlockElement :: GetProperty (IKSO_CUSTOM :: $ IBLOCKS ['brands'], $ BRAND_ID, "sort", "asc", array ("CODE" => "BRAND_CLASS")); while ($ ob = $ res-> GetNext ()) {$ VALUES [] = $ ob ['VALUE']; } then it doesn't work - Dolphin
  • The fact is that in the official manual that is written, not everything works correctly. By this turned here, because I thought that there are professionals in their field who can share knowledge =). - Dolphin
  • It makes no sense to give here the code from the manuals. You need to bring your own code and explain what goes wrong in it as you expect. - u_mulder
  • one
    "Poking" will be your classmates. - u_mulder

1 answer 1

I saw the comments, but did not understand what specifically does not work. Everything is correctly stated, to get values ​​from a multiple property, you need to use CIBlockElement::GetProperty , I will give an example:

 $iblockID = 1; // ID инфоблока $elementID = 2; // ID элемента $arOrder = []; // сортирока $arFilter = []; // фильтрация, можно по имени NAME => название $arProductsID = []; $rsProps = CIBlockElement::GetProperty($iblockID, $elementID, $arOrder, $arFilter); while($arrProps = $rsProps->Fetch()) { $arProductsID[] = $arrProps['VALUE']; // только для примера, фильтр главное правильный был print_r($arrProps); // тут в $arrProps в цикле будут возвращаться значения } // после уже запрос на получение информации о товарах $rsProducts = CIBlockElement::GetList([], ['ID' => $arProductsID], false, false, ['NAME']); // в последнем массиве указать какие свойства и поля нужны while($arrProduct = $rsProducts->Fetch()) { print_r($arrProduct); // вот тут уже будут товары } 

upd: updated the answer, added an example for receiving info on goods

  • one
    @Dolphin in $arrProps['VALUE'] will be the product ID, inside the cycle that $arProductIDs[] = $arrProps['VALUE'] all the IDs into an array, such as $arProductIDs[] = $arrProps['VALUE'] , and then outside the cycle already, below CIBlockElement::GetList([], ['ID' => $arProductIDs]) , the rest of the parameters are already as a tutorial, in $ arSelect add the necessary properties of the goods that need to be obtained. - maxkrasnov
  • one
    @Dolphin is not, in the cycle, requests to the database are not done correctly, you collect all the goods in the cycle ID and out of the cycle, then with one request you will receive all the goods for these IDs - maxkrasnov
  • one
    @Dolphin all the rules) updated the answer, something like this - maxkrasnov
  • one
    @Dolphin example without taking into account the subtleties of the version, etc. that is, there just in case you can check whether the array of ID empty or not empty, add IBLOCK_ID parameter to the filter by ID , etc. - maxkrasnov
  • one
    @Dolphin SRC not immediately available, the ID picture will be given in DETAIL_PICTURE , the path to the picture can be obtained using CFile::getPath - maxkrasnov