1С-Битрикс
- 16 ответов
- 0 вопросов
4
Вклад в тег
$brands = [];
$arF = ["IBLOCK_ID" => $IBLOCK_ID,"!PROPERTY_BRAND" => false];
$res = CIBlockElement::GetList(["PROPERTY_BRAND"=>"ASC"],$arF,["PROPERTY_BRAND"],false);
while($arRes = $res->Fetch()){
$brands[$arRes["PROPERTY_BRAND_VALUE"]] = $arRes["CNT"];
}
$brandsTMP = [];
$res = CIBlockPropertyEnum::GetList([], ["IBLOCK_ID"=>$IBLOCK_ID, "ID"=>array_keys[$brands]]);
while($arBrand = $res->fetch()){
$brandsTMP[$arBrand["ID"]] = [
"ID" => $arBrand["ID"],
"VALUE" => $arBrand["VALUE"],
"CNT" => $brands[$arBrand["ID"]]
]
}
$brands = $brandsTMP;