K
K
Konstantin2019-01-23 14:56:18
1C-Bitrix
Konstantin, 2019-01-23 14:56:18

How to make the element filter by the "list" property work in Bitrix?

Good afternoon,
I'm taking my first steps on Bitrix. There was one problem. I am sure that it is very easy to solve, but I just can not cope with it.
The bottom line is this: there are articles, I added the ARCHIVE property (list) in the infoblock to divide it into active and archive ones.
I have already tried everything that I googled, including from the docks. I'm most likely doing something wrong. Tell me what's wrong?

<?
$GLOBALS['arrFilter'] = array("PROPERTY_ARCHIVE_VALUE" => 'Y');
$APPLICATION->IncludeComponent("bitrix:news", "mir_o_nas", array(
  "IBLOCK_TYPE" => "o_nas",
  "IBLOCK_ID" => "20",
  "NEWS_COUNT" => "20",
  "USE_SEARCH" => "N",
  "USE_RSS" => "N",
  "USE_RATING" => "N",
  "USE_CATEGORIES" => "N",
  "USE_REVIEW" => "N",
  "USE_FILTER" => "Y",
  "FILTER_NAME" => "arrFilter",
  "FILTER_FIELD_CODE" => array(
    0 => "",
    1 => "",
  ),
  "FILTER_PROPERTY_CODE" => array(
    0 => "ARCHIVE",
    1 => "",
  ),
  "SORT_BY1" => "ID",
  "SORT_ORDER1" => "DESC",
  "SORT_BY2" => "SORT",
  "SORT_ORDER2" => "ASC",
  "CHECK_DATES" => "Y",
  "SEF_MODE" => "N",
  "SEF_FOLDER" => "/programs/",
        "AJAX_MODE" => "N",
  "AJAX_OPTION_JUMP" => "N",
  "AJAX_OPTION_STYLE" => "Y",
  "AJAX_OPTION_HISTORY" => "N",
  "CACHE_TYPE" => "A",
  "CACHE_TIME" => "36000000",
  "CACHE_FILTER" => "N",
  "CACHE_GROUPS" => "Y",
  "SET_TITLE" => "Y",
  "SET_STATUS_404" => "N",
  "INCLUDE_IBLOCK_INTO_CHAIN" => "Y",
  "ADD_SECTIONS_CHAIN" => "Y",
  "USE_PERMISSIONS" => "N",
  "PREVIEW_TRUNCATE_LEN" => "",
  "LIST_ACTIVE_DATE_FORMAT" => "d.m.Y",
  "LIST_FIELD_CODE" => array(
    0 => "",
    1 => "",
  ),
  "LIST_PROPERTY_CODE" => array(
    0 => "",
    1 => "",
  ),
  "HIDE_LINK_WHEN_NO_DETAIL" => "N",
  "DISPLAY_NAME" => "Y",
  "META_KEYWORDS" => "-",
  "META_DESCRIPTION" => "-",
  "BROWSER_TITLE" => "-",
  "DETAIL_ACTIVE_DATE_FORMAT" => "d.m.Y",
  "DETAIL_FIELD_CODE" => array(
    0 => "",
    1 => "",
  ),
  "DETAIL_PROPERTY_CODE" => array(
    0 => "",
    1 => "",
  ),
  "DETAIL_DISPLAY_TOP_PAGER" => "N",
  "DETAIL_DISPLAY_BOTTOM_PAGER" => "Y",
  "DETAIL_PAGER_TITLE" => "Страница",
  "DETAIL_PAGER_TEMPLATE" => "",
  "DETAIL_PAGER_SHOW_ALL" => "Y",
  "PAGER_TEMPLATE" => ".default",
  "DISPLAY_TOP_PAGER" => "N",
  "DISPLAY_BOTTOM_PAGER" => "Y",
  "PAGER_TITLE" => "Новости",
  "PAGER_SHOW_ALWAYS" => "Y",
  "PAGER_DESC_NUMBERING" => "N",
  "PAGER_DESC_NUMBERING_CACHE_TIME" => "36000",
  "PAGER_SHOW_ALL" => "Y",
  "DISPLAY_DATE" => "Y",
  "DISPLAY_PICTURE" => "Y",
  "DISPLAY_PREVIEW_TEXT" => "Y",
  "USE_SHARE" => "N",
  "AJAX_OPTION_ADDITIONAL" => "",
  "VARIABLE_ALIASES" => array(
    "SECTION_ID" => "SECTION_ID",
    "ELEMENT_ID" => "ELEMENT_ID",
  )
  ),
  false
);?>

Answer the question

In order to leave comments, you need to log in

1 answer(s)
I
Ilya, 2019-01-23
@dukonst

You have an ARCHIVE property of type List. You have created two value variants for this property, for example:
- 123--active--Active
- 456--archive--Archive
Here:
123 -- value variant identifier
active -- value XML code
Active -- description of the value.
Let's say you want to filter only active records. This can be done in two ways.
one.

$GLOBALS['arrFilter'] = array("PROPERTY_ARCHIVE" => 123);

2.
$GLOBALS['arrFilter'] = array("PROPERTY_ARCHIVE_VALUE" => 'Активное');

Source: https://dev.1c-bitrix.ru/api_help/iblock/classes/c...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question