D
D
drewandrew2020-07-18 19:57:35
1C-Bitrix
drewandrew, 2020-07-18 19:57:35

How to show all variants of product properties in a smart filter?

It is necessary that the filter contains all variants of product properties, even if there is no such product at the moment.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
P
PetrPo, 2020-07-19
@drewandrew

1. Disable the faceted index for the required infoblock
2. Make a custom component catalog.smart.filter
- find the line in the component.php file - add it before this line
foreach($arElements as $arElement)

if(isset($this->arResult['PROPERTY_ID_LIST']) && $this->arResult['PROPERTY_ID_LIST']) {
  $propertiesList = array();
  
  foreach($this->arResult['PROPERTY_ID_LIST'] as $propertyId) {
    $dbRes = CIBlockPropertyEnum::GetList(array('ID' => 'ASC'), array('PROPERTY_ID' => $propertyId));
    
    while($arRes = $dbRes->Fetch()) {
      $this->fillItemValues($arResult['ITEMS'][$arRes['PROPERTY_ID']], $arRes['ID']);
    }
  }
}

UPD
corrected the code a bit

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question