T
T
Tupic1232021-02-05 19:50:16
PHP
Tupic123, 2021-02-05 19:50:16

Display element property in search?

Hello!

In the process of implementing the search, a need arose next to the element to display its properties, such as PRICE NDS EMPTY.

Search results output code:

<?elseif(count($arResult["SEARCH"])>0):?>
  <?if($arParams["DISPLAY_TOP_PAGER"] != "N") echo $arResult["NAV_STRING"]?>
  <div class="search-items-wrapper">
  <?foreach($arResult["SEARCH"] as $arItem):?>
    <div class="news-item">
    <a class="service__link" href="<?echo $arItem["URL"]?>"><?echo $arItem["TITLE_FORMATED"]?></a>

    <p class="service__field"></p>
    <p class="service__field"></p>
    <p class="service__field"></p>
    </div>
  <?endforeach;?>


The component itself:
APPLICATION->SetTitle("Поиск");?><?$APPLICATION->IncludeComponent(
  "bitrix:search.page",
  "search-service-inner",
  Array(
    "AJAX_MODE" => "Y",
    "AJAX_OPTION_ADDITIONAL" => "",
    "AJAX_OPTION_HISTORY" => "N",
    "AJAX_OPTION_JUMP" => "Y",
    "AJAX_OPTION_STYLE" => "Y",
    "CACHE_TIME" => "3600",
    "CACHE_TYPE" => "A",
    "CHECK_DATES" => "Y",
    "COLOR_NEW" => "000000",
    "COLOR_OLD" => "C8C8C8",
    "COLOR_TYPE" => "Y",
    "DEFAULT_SORT" => "rank",
    "DISPLAY_BOTTOM_PAGER" => "Y",
    "DISPLAY_TOP_PAGER" => "N",
    "FILTER_NAME" => "",
    "FONT_MAX" => "50",
    "FONT_MIN" => "10",
    "NAME_TEMPLATE" => "#LAST_NAME# #NAME#",
    "NO_WORD_LOGIC" => "N",
    "PAGER_SHOW_ALWAYS" => "Y",
    "PAGER_TEMPLATE" => "round",
    "PAGER_TITLE" => "Результаты поиска",
    "PAGE_RESULT_COUNT" => "10",
    "PATH_TO_USER_PROFILE" => "#SITE_DIR#people/user/#USER_ID#/",
    "PERIOD_NEW_TAGS" => "",
    "RATING_TYPE" => "",
    "RESTART" => "N",
    "SHOW_CHAIN" => "Y",
    "SHOW_ITEM_DATE_CHANGE" => "Y",
    "SHOW_ITEM_TAGS" => "Y",
    "SHOW_LOGIN" => "Y",
    "SHOW_ORDER_BY" => "Y",
    "SHOW_RATING" => "",
    "SHOW_TAGS_CLOUD" => "N",
    "SHOW_WHEN" => "N",
    "SHOW_WHERE" => "N",
    "STRUCTURE_FILTER" => "structure",
    "TAGS_INHERIT" => "Y",
    "TAGS_PAGE_ELEMENTS" => "20",
    "TAGS_PERIOD" => "",
    "TAGS_SORT" => "NAME",
    "TAGS_URL_SEARCH" => "",
    "USE_LANGUAGE_GUESS" => "Y",
    "USE_SUGGEST" => "Y",
    "USE_TITLE_RANK" => "N",
    "WIDTH" => "100%",
    "arrFILTER" => array(),
    "arrFILTER_iblock_news" => array(0=>"all",),
    "arrFILTER_iblock_service" => array(),
    "arrWHERE" => array(0=>"iblock_news",)
  )
);?>

And here is the task, how to display the values ​​of the properties of each element in a loop and specify them in ? I tried to print the arResult and arItem array, but I did not find any properties there. <p class="service__field"></p>

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexey Emelyanov, 2021-02-05
@Tupic123

In the result_modifier.php of this component, by element ID and IBLOCK_ID, select the properties you need

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question