Answer the question
In order to leave comments, you need to log in
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);
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question