40 if ($this->filterFields ===
null)
42 $offers = (!empty($this->catalog[
'CATALOG_TYPE']) && $this->catalog[
'CATALOG_TYPE'] == \CCatalogSku::TYPE_OFFERS);
44 $this->filterFields = [];
45 $listProperty = $this->getListProperty();
46 foreach ($listProperty as $property)
48 $fieldId = $property[
'FIELD_ID'];
50 ?
Loc::getMessage(
'IBLOCK_PROPERTY_FILTER_MANAGER_MESS_OFFER_TITLE', [
'#NAME#' => $property[
'NAME']])
54 if (!empty($property[
'USER_TYPE']))
57 if (isset($property[
"PROPERTY_USER_TYPE"][
"GetUIFilterProperty"]))
67 $property[
"PROPERTY_USER_TYPE"][
"GetUIFilterProperty"],
70 [
"VALUE" => $fieldId,
"FORM_NAME" =>
"main-ui-filter"],
75 elseif (isset($property[
"PROPERTY_USER_TYPE"][
"GetPublicFilterHTML"]))
81 'value' => call_user_func_array(
82 $property[
'PROPERTY_USER_TYPE'][
'GetPublicFilterHTML'],
87 'FORM_NAME' =>
'main-ui-filter',
94 elseif (isset($property[
"PROPERTY_USER_TYPE"][
"GetAdminFilterHTML"]))
100 'value' => call_user_func_array(
101 $property[
'PROPERTY_USER_TYPE'][
'GetAdminFilterHTML'],
106 'FORM_NAME' =>
'main-ui-filter',
117 elseif (empty($field))
121 'name' => $fieldName,
125 $this->filterFields[] = $field;
129 switch ($property[
'PROPERTY_TYPE'])
131 case Iblock\PropertyTable::TYPE_STRING:
132 $this->filterFields[] = [
134 'name' => $fieldName,
138 case Iblock\PropertyTable::TYPE_NUMBER:
139 $this->filterFields[] = [
141 'name' => $fieldName,
146 case Iblock\PropertyTable::TYPE_LIST:
150 $enumIterator = Iblock\PropertyEnumerationTable::getList([
157 '=PROPERTY_ID' => $property[
'ID'],
165 while ($enumRow = $enumIterator->fetch())
167 $items[$enumRow[
'ID']] = $enumRow[
'VALUE'];
169 unset($enumRow, $enumIterator);
170 $this->filterFields[] = [
172 'name' => $fieldName,
181 case Iblock\PropertyTable::TYPE_ELEMENT:
182 $this->filterFields[] = [
184 'name' => $fieldName,
185 'type' =>
'custom_entity',
187 'property' => $property,
189 'Bitrix\Iblock\Helpers\Filter\Property',
193 'Bitrix\Iblock\Helpers\Filter\Property',
198 case Iblock\PropertyTable::TYPE_SECTION:
200 $sectionQueryObject = \CIBlockSection::getList(
202 'LEFT_MARGIN' =>
'ASC',
205 'IBLOCK_ID' => $property[
'LINK_IBLOCK_ID'],
216 while ($section = $sectionQueryObject->fetch())
218 $margin = max((
int)$section[
'DEPTH_LEVEL'], 1) - 1;
219 $items[$section[
'ID']] = str_repeat(
'. ', $margin) . $section[
'NAME'];
221 unset($section, $sectionQueryObject);
222 $this->filterFields[] = [
224 'name' => $fieldName,
237 unset($property, $listProperty);
241 return $this->filterFields;
280 $listProperty = $this->getListProperty();
281 if (empty($listProperty))
289 $filterFields[$row[
'id']] = $row;
292 foreach (array_keys($filter) as $index)
294 $indexData = \CIBlock::MkOperationFilter($index);
295 $propertyId = $indexData[
'FIELD'];
297 if (!isset($listProperty[$propertyId]))
302 if (isset($filterFields[$propertyId][
'customFilter']))
304 $row = $filterFields[$propertyId];
306 call_user_func_array(
307 $row[
'customFilter'],
311 "VALUE" => $row[
"id"],
312 "FILTER_ID" => $filterId,
321 elseif (isset($listProperty[$propertyId][
'PROPERTY_USER_TYPE'][
'AddFilterFields']))
324 $row = $listProperty[$propertyId];
325 call_user_func_array(
326 $row[
'PROPERTY_USER_TYPE'][
'AddFilterFields'],
330 'VALUE' => $row[
'FIELD_ID'],
331 'FILTER_ID' => $filterId,
342 switch ($listProperty[$propertyId][
'PROPERTY_TYPE'])
344 case Iblock\PropertyTable::TYPE_STRING:
345 case Iblock\PropertyTable::TYPE_NUMBER:
346 $value = (string)$filter[$index];
349 unset($filter[$index]);
353 case Iblock\PropertyTable::TYPE_LIST:
354 case Iblock\PropertyTable::TYPE_ELEMENT:
355 case IBlock\PropertyTable::TYPE_SECTION:
356 if (is_array($filter[$index]))
359 foreach ($filter[$index] as $value)
361 $newValues[] = ($value ===
'NOT_REF' ? false : $value);
363 unset($filter[$index]);
364 if (!empty($newValues))
366 $filter[
'=' . $propertyId] = $newValues;
372 $value = $filter[$index];
373 unset($filter[$index]);
374 if ($value ===
'NOT_REF')
378 $filter[
'='.$propertyId] = $value;
385 unset($filterFields);
386 unset($listProperty);