V
V
viktorulyushev2017-01-30 20:46:15
1C-Bitrix
viktorulyushev, 2017-01-30 20:46:15

Bitrix. How to set a double condition for a filter?

There is a section catalog component, elements with different labels are displayed, I made a filter to display them with labels

<?$GLOBALS['arrFilterHit'] = array('PROPERTY_KHIT_VALUE' => 'Да');?>
<?$APPLICATION->IncludeComponent(
  "bitrix:catalog.section", 
  "catalog_plitka_hit", 
  array(
    "IBLOCK_TYPE" => "1c_catalog",
    "IBLOCK_ID" => "26",
    "SECTION_ID" => "",
    "SECTION_CODE" => $code,
    "SECTION_USER_FIELDS" => array(
      0 => "",
      1 => "",
    ),
    "ELEMENT_SORT_FIELD" => $sort,
    "ELEMENT_SORT_ORDER" => $dir,
    "ELEMENT_SORT_FIELD2" => "id",
    "ELEMENT_SORT_ORDER2" => "desc",
    "FILTER_NAME" => "arrFilterHit",
    "INCLUDE_SUBSECTIONS" => "Y",
    "SHOW_ALL_WO_SECTION" => "Y",
    "HIDE_NOT_AVAILABLE" => "N",
    "PAGE_ELEMENT_COUNT" => "3",
    "LINE_ELEMENT_COUNT" => "1",
    "PROPERTY_CODE" => array(
      0 => "",
      1 => "FILES",
      2 => "",
    ),
    "OFFERS_FIELD_CODE" => array(
      0 => "",
      1 => "",
    ),
    "OFFERS_PROPERTY_CODE" => array(
      0 => "",
      1 => "",
    ),
    "OFFERS_SORT_FIELD" => "sort",
    "OFFERS_SORT_ORDER" => "asc",
    "OFFERS_SORT_FIELD2" => "id",
    "OFFERS_SORT_ORDER2" => "desc",
    "OFFERS_LIMIT" => "5",
    "TEMPLATE_THEME" => "blue",
    "PRODUCT_DISPLAY_MODE" => "N",
    "ADD_PICT_PROP" => "-",
    "LABEL_PROP" => "-",
    "PRODUCT_SUBSCRIPTION" => "N",
    "SHOW_DISCOUNT_PERCENT" => "Y",
    "SHOW_OLD_PRICE" => "Y",
    "MESS_BTN_BUY" => "Купить",
    "MESS_BTN_ADD_TO_BASKET" => "В корзину",
    "MESS_BTN_SUBSCRIBE" => "Подписаться",
    "MESS_BTN_DETAIL" => "Подробнее",
    "MESS_NOT_AVAILABLE" => "Нет в наличии",
    "SECTION_URL" => "",
    "DETAIL_URL" => "",
    "SECTION_ID_VARIABLE" => "SECTION_ID",
    "AJAX_MODE" => "N",
    "AJAX_OPTION_JUMP" => "N",
    "AJAX_OPTION_STYLE" => "Y",
    "AJAX_OPTION_HISTORY" => "N",
    "CACHE_TYPE" => "A",
    "CACHE_TIME" => "36000000",
    "CACHE_GROUPS" => "Y",
    "SET_META_KEYWORDS" => "Y",
    "META_KEYWORDS" => "-",
    "SET_META_DESCRIPTION" => "Y",
    "META_DESCRIPTION" => "-",
    "BROWSER_TITLE" => "-",
    "ADD_SECTIONS_CHAIN" => "N",
    "DISPLAY_COMPARE" => "N",
    "SET_TITLE" => "Y",
    "SET_STATUS_404" => "Y",
    "CACHE_FILTER" => "Y",
    "PRICE_CODE" => array(
    ),
    "USE_PRICE_COUNT" => "N",
    "SHOW_PRICE_COUNT" => "1",
    "PRICE_VAT_INCLUDE" => "Y",
    "CONVERT_CURRENCY" => "N",
    "BASKET_URL" => "/personal/basket/",
    "ACTION_VARIABLE" => "action",
    "PRODUCT_ID_VARIABLE" => "id",
    "USE_PRODUCT_QUANTITY" => "Y",
    "ADD_PROPERTIES_TO_BASKET" => "Y",
    "PRODUCT_PROPS_VARIABLE" => "prop",
    "PARTIAL_PRODUCT_PROPERTIES" => "N",
    "PRODUCT_PROPERTIES" => array(
    ),
    "OFFERS_CART_PROPERTIES" => "",
    "PAGER_TEMPLATE" => "publi",
    "DISPLAY_TOP_PAGER" => "N",
    "DISPLAY_BOTTOM_PAGER" => "Y",
    "PAGER_TITLE" => "Товары",
    "PAGER_SHOW_ALWAYS" => "N",
    "PAGER_DESC_NUMBERING" => "N",
    "PAGER_DESC_NUMBERING_CACHE_TIME" => "36000",
    "PAGER_SHOW_ALL" => "N",
    "AJAX_OPTION_ADDITIONAL" => "",
    "PRODUCT_QUANTITY_VARIABLE" => "quantity",
    "COMPARE_ID" => $_SESSION["CATALOG_COMPARE_LIST"][26]["ITEMS"],
    "SET_BROWSER_TITLE" => "Y",
    "CITY" => $_SESSION["CITY_NAME"],
    "SHOW_404" => "Y",
    "FILE_404" => "",
    "COMPONENT_TEMPLATE" => "catalog_plitka",
    "BACKGROUND_IMAGE" => "-",
    "URLL" => "/bitrix/admin/component_props.php?component_name=bitrix%3Acatalog.section&component_template=catalog_plitka&template_id=kerasol_adp&lang=ru&src_path=%2Fkatalog%2Findex.php&src_line=684&src_page=%2Fkatalog%2Fkeramicheskaya_plitka%2F&src_site=s1&siteTemplateId=kerasol_adp&bxsender=core_window_cdialog",
    "SEF_MODE" => "N",
    "SET_LAST_MODIFIED" => "N",
    "USE_MAIN_ELEMENT_SECTION" => "N",
    "PAGER_BASE_LINK_ENABLE" => "N",
    "DISABLE_INIT_JS_IN_COMPONENT" => "N"
  ),
  false
);?>

But if there is no product with the hit tag in the category, then it will not display anything, how to make it display any elements if there is no such product?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
R
Roman Gritsuk, 2017-01-31
@viktorulyushev

Do sorting instead of filtering. Then in the first place you will have products with the hit property, and only then the rest.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question