P
P
Pavel Sidorov2019-06-19 12:03:48
1C-Bitrix
Pavel Sidorov, 2019-06-19 12:03:48

How to filter data by property "Binding to elements, type multiple"?

Colleagues, good afternoon. I set up the binding to elements property in the infoblock, I specified all the data. Multiple type.
The product has been linked to other products.
On the detail.php page, after displaying the detailed product card, I made the following.
property binding to elements is called - RECOOM infoblock
id 14
goods lie without sections

<?  GLOBAL $arrFilterProduct;
        $idsRecom = array();
        $res = CIBlockElement::GetProperty(14,$_REQUEST["ELEMENT_ID"], "sort", "asc", Array("CODE"=>"RECOOM"));	
        while ($ar_res = $res->GetNext()) {
          $idsRecom[] = $ar_res['VALUE'];
        }
        if ( !empty($idsRecom[0]) ) {
          $arrFilterProduct = array("ID" => $idsRecom ); 
        } else {
          
        }  

$APPLICATION->IncludeComponent(
  "bitrix:catalog.top", 
  "recco", 
  array(
    "IBLOCK_TYPE" => "catalog",
    "IBLOCK_ID" => "14",
    "ELEMENT_SORT_FIELD" => "sort",
    "ELEMENT_SORT_ORDER" => "asc",
    "ELEMENT_SORT_FIELD2" => "name",
    "ELEMENT_SORT_ORDER2" => "desc",
    "FILTER_NAME" => "arrFilterProduct",
    "HIDE_NOT_AVAILABLE" => "N",
    "ELEMENT_COUNT" => "9",
    "LINE_ELEMENT_COUNT" => "3",
    "PROPERTY_CODE" => array(
      0 => "new",
      1 => "collection",
      2 => "more_photo",
      3 => "",
    ),
    "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" => "0",
    "VIEW_MODE" => "SECTION",
    "TEMPLATE_THEME" => "blue",
    "PRODUCT_DISPLAY_MODE" => "N",
    "ADD_PICT_PROP" => "-",
    "LABEL_PROP" => "-",
    "SHOW_DISCOUNT_PERCENT" => "Y",
    "SHOW_OLD_PRICE" => "Y",
    "MESS_BTN_BUY" => "Купить",
    "MESS_BTN_ADD_TO_BASKET" => "В корзину",
    "MESS_BTN_DETAIL" => "",
    "MESS_NOT_AVAILABLE" => "Нет в наличии",
    "SECTION_URL" => "",
    "DETAIL_URL" => "",
    "SECTION_ID_VARIABLE" => "SECTION_ID",
    "CACHE_TYPE" => "A",
    "CACHE_TIME" => "36000000",
    "CACHE_GROUPS" => "N",
    "DISPLAY_COMPARE" => "N",
    "CACHE_FILTER" => "N",
    "PRICE_CODE" => array(
      0 => "BASE",
    ),
    "USE_PRICE_COUNT" => "N",
    "SHOW_PRICE_COUNT" => "1",
    "PRICE_VAT_INCLUDE" => "N",
    "CONVERT_CURRENCY" => "Y",
    "CURRENCY_ID" => "RUB",
    "BASKET_URL" => "/personal/cart/index.php",
    "ACTION_VARIABLE" => "action",
    "PRODUCT_ID_VARIABLE" => "id",
    "USE_PRODUCT_QUANTITY" => "N",
    "ADD_PROPERTIES_TO_BASKET" => "Y",
    "PRODUCT_PROPS_VARIABLE" => "prop",
    "PARTIAL_PRODUCT_PROPERTIES" => "N",
    "PRODUCT_PROPERTIES" => array(
    ),
    "OFFERS_CART_PROPERTIES" => array(
    ),
    "PRODUCT_QUANTITY_VARIABLE" => "quantity",
    "COMPONENT_TEMPLATE" => "monaliza_catalog_top_slide",
    "SEF_MODE" => "N",
    "CUSTOM_FILTER" => "",
    "HIDE_NOT_AVAILABLE_OFFERS" => "N",
    "COMPATIBLE_MODE" => "Y"
  ),
  false
);?>

I just want to filter by property. Tell me what I'm doing wrong?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
Y
Yaroslav Alexandrov, 2019-06-19
@alexyarik

global $arrFilterProduct;
$arrFilterProduct = array(
"=ID" => $arResult['PROPERTIES']['RECOOM']['VALUE'],
);

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question