R
R
RuRoman2021-12-23 14:19:42
1C-Bitrix
RuRoman, 2021-12-23 14:19:42

How to display all properties and values ​​of Bitrix composite product?

How can I display all the properties of a composite product in Bitrix, I try the following code:

$iblockElementId = ID товара;

   $arOrder = [];
   $arFilter = ['ID' => $iblockElementId];
   $arGroupBy = false;
   $arNavStartParams = false;
   $arSelectFields = ['ID', '*'];

   $dbRes = \CIBlockElement::GetList(
      $arOrder,
      $arFilter,
      $arGroupBy,
      $arNavStartParams,
      $arSelectFields
   );

   $element = $dbRes->Fetch();

   $propsDbres = \CIBlockElement::GetProperty($element['IBLOCK_ID'], $iblockElementId, "sort", "asc", array(">ID" => 1));

   $i = 0;
   while ($prop = $propsDbres->GetNext()) {
      $i = !isset($element['PROPS'][$prop['CODE'
      ]]) ? 0 : $i+1;
      $element['PROPS'][$prop['CODE']]['NAME'] = $prop['NAME'];
      $element['PROPS'][$prop['CODE']]['TYPE'] = $prop['PROPERTY_TYPE'];
      $element['PROPS'][$prop['CODE']]['ACTIVE'] = $prop['ACTIVE'];

      $element['PROPS'][$prop['CODE']]['VALUES'][$i] = [
         'VALUE' => $prop['VALUE'],
         'DESCRIPTION' => $prop['DESCRIPTION'],
      ];

      if ($prop['PROPERTY_TYPE'] == 'F')
         $element['PROPS'][$prop['CODE']]['VALUE'][$i]['PATH'] = \CFile::GetPath(intval($prop['VALUE']));
   }

   print_r($element);


Properties are displayed, but not all, there are no pictures, no product price and no price and characteristics of the constituent elements.

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question