G
G
Goldsliders2022-02-15 19:21:49
1C-Bitrix
Goldsliders, 2022-02-15 19:21:49

How to filter through arrfilter in Bitrix, by property type reference?

There is a code:

<?
   $GLOBALS['arrBrandName'] = array("PROPERTY_MARKA_VALUE" => $arResult['NAME']);
   print_r($GLOBALS['arrBrandName']);
   $APPLICATION->IncludeComponent(
  "bitrix:catalog.section", 
  "product-list-brand", 
  array(
  "USE_FILTER" => 'Y',
    "ACTION_VARIABLE" => "action",
    "ADD_PICT_PROP" => "-",
    "ADD_PROPERTIES_TO_BASKET" => "Y",
    "ADD_SECTIONS_CHAIN" => "N",
    "ADD_TO_BASKET_ACTION" => "ADD",
    "AJAX_MODE" => "N",
    "AJAX_OPTION_ADDITIONAL" => "",
    "AJAX_OPTION_HISTORY" => "N",
    "AJAX_OPTION_JUMP" => "N",
    "AJAX_OPTION_STYLE" => "Y",
    "BACKGROUND_IMAGE" => "",
    "BASKET_URL" => SITE_DIR."basket/",
    "BRAND_PROPERTY" => "-",
    "BROWSER_TITLE" => "-",
    "CACHE_FILTER" => "N",
    "CACHE_GROUPS" => "Y",
    "CACHE_TIME" => "36000000",
    "CACHE_TYPE" => "A",
    "COMPATIBLE_MODE" => "N",
    "CONVERT_CURRENCY" => "N",
    "CURRENCY_ID" => "",
    "DATA_LAYER_NAME" => "",
    "DETAIL_URL" => SITE_DIR."catalog/#SECTION_CODE_PATH#/#ELEMENT_CODE#/",
    "DISABLE_INIT_JS_IN_COMPONENT" => "N",
    "DISCOUNT_PERCENT_POSITION" => "bottom-right",
    "DISPLAY_BOTTOM_PAGER" => "N",
    "DISPLAY_TOP_PAGER" => "N",
    "ELEMENT_SORT_FIELD" => $sortField,
    "ELEMENT_SORT_ORDER" => $sortOrder,
    "ELEMENT_SORT_FIELD2" => "shows",
    "ELEMENT_SORT_ORDER2" => "asc",
    "ENLARGE_PRODUCT" => "STRICT",
    "ENLARGE_PROP" => "-",
    "FILTER_NAME" => "arrBrandName",
    "HIDE_NOT_AVAILABLE" => "N",
    "HIDE_NOT_AVAILABLE_OFFERS" => "N",
    "IBLOCK_ID" => 4,
    "IBLOCK_TYPE" => "info",
    "INCLUDE_SUBSECTIONS" => "Y",
    "LABEL_PROP" => array(
      0 => "PRODUCT_HIT",
      1 => "NEW",
    ),
    "LABEL_PROP_MOBILE" => "",
    "LABEL_PROP_POSITION" => "top-right",
    "LAZY_LOAD" => "N",
    "LINE_ELEMENT_COUNT" => "3",
    "LOAD_ON_SCROLL" => "N",
    "MESSAGE_404" => "",
    "META_KEYWORDS" => "-",
    "OFFERS_CART_PROPERTIES" => "",
    "OFFERS_FIELD_CODE" => array(
      0 => "",
      1 => "",
    ),
    "OFFERS_LIMIT" => "0",
    "OFFERS_PROPERTY_CODE" => $arParams["OFFERS_PROPERTY_CODE"],
    "OFFERS_SORT_FIELD" => "shows",
    "OFFERS_SORT_FIELD2" => "shows",
    "OFFERS_SORT_ORDER" => "asc",
    "OFFERS_SORT_ORDER2" => "asc",
    "OFFER_ADD_PICT_PROP" => "-",
    "OFFER_TREE_PROPS" => "",
    "PAGER_BASE_LINK_ENABLE" => "N",
    "PAGER_DESC_NUMBERING" => "N",
    "PAGER_DESC_NUMBERING_CACHE_TIME" => "36000",
    "PAGER_SHOW_ALL" => "Y",
    "PAGER_SHOW_ALWAYS" => "Y",
    "PAGER_TEMPLATE" => ".default",
    "PAGER_TITLE" => "Товары",
    "PAGE_ELEMENT_COUNT" => "20",
    "PARTIAL_PRODUCT_PROPERTIES" => "Y",
    "PRICE_CODE" => array(
      0 => "ru",
    ),
    "PRICE_VAT_INCLUDE" => "Y",
    "PRODUCT_BLOCKS_ORDER" => "price,props,sku,quantityLimit,quantity,buttons,compare",
    "PRODUCT_DISPLAY_MODE" => "N",
    "PRODUCT_ID_VARIABLE" => "id",
    "PRODUCT_PROPERTIES" => array(
    ),
    "PRODUCT_PROPS_VARIABLE" => "prop",
    "PRODUCT_QUANTITY_VARIABLE" => "quantity",
    "PRODUCT_ROW_VARIANTS" => "[{'VARIANT':'3','BIG_DATA':false},{'VARIANT':'3','BIG_DATA':false},{'VARIANT':'3','BIG_DATA':false},{'VARIANT':'3','BIG_DATA':false},{'VARIANT':'3','BIG_DATA':false}]",
    "PRODUCT_SUBSCRIPTION" => "Y",
    "PROPERTY_CODE" => array(
      0 => "",
      1 => $arParams["CATALOG_PROPPERTY"],
      2 => "",
    ),
    "PROPERTY_CODE_MOBILE" => "",
    "RCM_PROD_ID" => "",
    "RCM_TYPE" => "personal",
    "SECTION_CODE" => "",
    "SECTION_ID" => "",
    "SECTION_ID_VARIABLE" => "SECTION_ID",
    "SECTION_URL" => SITE_DIR."catalog/#SECTION_CODE_PATH#/",
    "SECTION_USER_FIELDS" => array(
      0 => "",
      1 => "",
    ),
    "SEF_MODE" => "Y",
    "SET_BROWSER_TITLE" => "N",
    "SET_LAST_MODIFIED" => "N",
    "SET_META_DESCRIPTION" => "N",
    "SET_META_KEYWORDS" => "Y",
    "SET_STATUS_404" => "N",
    "SET_TITLE" => "N",
    "SHOW_404" => "N",
    "SHOW_ALL_WO_SECTION" => "Y",
    "SHOW_CLOSE_POPUP" => "Y",
    "SHOW_DISCOUNT_PERCENT" => "Y",
    "SHOW_FROM_SECTION" => "N",
    "SHOW_MAX_QUANTITY" => "N",
    "SHOW_OLD_PRICE" => "Y",
    "SHOW_PRICE_COUNT" => "1",
    "SHOW_SLIDER" => "Y",
    "SLIDER_INTERVAL" => "3000",
    "SLIDER_PROGRESS" => "N",
    "TEMPLATE_THEME" => "blue",
    "USE_ENHANCED_ECOMMERCE" => "Y",
    "USE_MAIN_ELEMENT_SECTION" => "N",
    "USE_PRICE_COUNT" => "N",
    "USE_PRODUCT_QUANTITY" => "Y",
    "DISPLAY_COMPARE" => "N",
    "SEF_RULE" => "",
    "SECTION_CODE_PATH" => "",
    "SECTION_DATA" => $section,
    "COMPONENT_TEMPLATE" => "product-list-brand",
    "MESS_BTN_BUY" => "Купить",
    "MESS_BTN_ADD_TO_BASKET" => "В корзину",
    "MESS_BTN_SUBSCRIBE" => "Подписаться",
    "MESS_BTN_DETAIL" => "Подробнее",
    "MESS_NOT_AVAILABLE" => "Нет в наличии",
    "META_DESCRIPTION" => "-"
  ),
    $component
);
                                ?>

But it is not possible to filter, on all pages the same products a must be filtered by the reference type property.

Maybe I'm doing it wrong?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Alexander Kovalev, 2022-02-20
@Goldsliders

Try filtering not by value, but by xml_id value, something like this:

$GLOBALS['arrBrandName'] = ["PROPERTY_MARKA" => $xmlId];

R
Rst0, 2022-02-18
@Rst0

Here is a detailed manual with an example:
Example. Sorting in Components
Did you pass the $sortField variable this way?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question