G
G
garmon852019-02-11 16:35:29
1C-Bitrix
garmon85, 2019-02-11 16:35:29

How can I display products through the catalog.section component in the given order?

Good afternoon, please tell me how to display products through the catalog.section component in the specified order.
How I'm trying to implement: I get an array of product ids and pass them to the filter Next, I call the component with the required parameters
$GLOBALS['arrFilter'] = array('ID' => $prod_ids);

$APPLICATION->IncludeComponent(
  "bitrix:catalog.section", 
  "dream_catalog_section_filter", 
  array(
  
    "ACTION_VARIABLE" => "action",
    "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" => "/personal/basket.php",
    "BROWSER_TITLE" => "NAME",
    "CACHE_FILTER" => "Y",
    "CACHE_GROUPS" => "Y",
    "CACHE_TIME" => "36000000",
    "CACHE_TYPE" => "A",
    "CONVERT_CURRENCY" => "N",
    "DETAIL_URL" => "/#SECTION_CODE_PATH#/#CODE#/",
    "DISABLE_INIT_JS_IN_COMPONENT" => "N",
    "DISPLAY_BOTTOM_PAGER" => "Y",
    "DISPLAY_TOP_PAGER" => "N",
    "ELEMENT_SORT_FIELD" => $selectedSort["FIELD"],
    "ELEMENT_SORT_FIELD2" => "id",
    "ELEMENT_SORT_ORDER" => $selectedSort["ORDER"],
    "ELEMENT_SORT_ORDER2" => "desc",
    "USE_FILTER" => "Y",
    "FILTER_NAME" => "arrFilter",
    "HIDE_NOT_AVAILABLE" => "N",
    "IBLOCK_ID" => "5",
    "IBLOCK_TYPE" => "catalog",
    "INCLUDE_SUBSECTIONS" => "Y",
    "LINE_ELEMENT_COUNT" => "2",
    "MESSAGE_404" => "",
    "MESS_BTN_ADD_TO_BASKET" => "Добавить в корзину",
    "MESS_BTN_BUY" => "Купить",
    "MESS_BTN_DETAIL" => "Подробнее",
    "MESS_BTN_SUBSCRIBE" => "Уведомить о поступлении",
    "MESS_NOT_AVAILABLE" => "Товар отсутствует",
    "META_DESCRIPTION" => "-",
    "META_KEYWORDS" => "-",
    "OFFERS_LIMIT" => "0",
    "PAGER_BASE_LINK_ENABLE" => "N",
    "PAGER_DESC_NUMBERING" => "N",
    "PAGER_DESC_NUMBERING_CACHE_TIME" => "36000",
    "PAGER_SHOW_ALL" => "N",
    "PAGER_SHOW_ALWAYS" => "N",
    "PAGER_TEMPLATE" => "dream_pagination",
    "PAGER_TITLE" => "",
    "PAGE_ELEMENT_COUNT" => $mylimit,
    "PARTIAL_PRODUCT_PROPERTIES" => "N",
    "PRICE_CODE" => array(
      0 => "BASE",
    ),
    "PRICE_VAT_INCLUDE" => "Y",
    "PRODUCT_ID_VARIABLE" => "id",
    "PRODUCT_PROPERTIES" => array(
    ),
    "PRODUCT_PROPS_VARIABLE" => "prop",
    "PRODUCT_QUANTITY_VARIABLE" => "",
    "PRODUCT_SUBSCRIPTION" => "N",
    "PROPERTY_CODE" => array(
      0 => "GENERAL_PROPERTIES",
      1 => "PEOPLE_CATEGORY_FILTER",
      2 => "COMFORT_FILTER",
      3 => "FILLER_FILTER",
      4 => "PRICE_FILTER",
      5 => "SPRINGS_FILTER",
      6 => "",
    ),
    "SECTION_URL" => "",
    "SECTION_USER_FIELDS" => array(
      0 => "UF_SHORT_DESCRIPTION",
      1 => "",
    ),
    "SEF_MODE" => "N",
    "SET_BROWSER_TITLE" => "Y",
    "SET_LAST_MODIFIED" => "N",
    "SET_META_DESCRIPTION" => "Y",
    "SET_META_KEYWORDS" => "Y",
    "SET_STATUS_404" => "N",
    "SET_TITLE" => "Y",
    "SHOW_404" => "N",
    "SHOW_ALL_WO_SECTION" => "Y",
    "SHOW_CLOSE_POPUP" => "N",
    "SHOW_DISCOUNT_PERCENT" => "N",
    "SHOW_OLD_PRICE" => "N",
    "SHOW_PRICE_COUNT" => "1",
    "TEMPLATE_THEME" => "blue",
    "USE_MAIN_ELEMENT_SECTION" => "N",
    "USE_PRICE_COUNT" => "N",
    "USE_PRODUCT_QUANTITY" => "N",
    "COMPONENT_TEMPLATE" => "dream_catalog_section_filter",
    "OFFERS_FIELD_CODE" => array(
      0 => "ID",
      1 => "CODE",
      2 => "NAME",
      3 => "PREVIEW_TEXT",
      4 => "PREVIEW_PICTURE",
      5 => "DETAIL_TEXT",
      6 => "DETAIL_PICTURE",
      7 => "IBLOCK_ID",
      8 => "IBLOCK_CODE",
      9 => "",
    ),
    "OFFERS_PROPERTY_CODE" => array(
      0 => "WINDOW",
      1 => "SPRING_UNIT",
      2 => "LENGTH",
      3 => "WIDTH",
      4 => "",
    ),
    "OFFERS_SORT_FIELD" => $selectedSort["FIELD"],
    "OFFERS_SORT_ORDER" => $selectedSort["ORDER"],
    "OFFERS_SORT_FIELD2" => "id",
    "OFFERS_SORT_ORDER2" => "desc",
    "PRODUCT_DISPLAY_MODE" => "N",
    "ADD_PICT_PROP" => "-",
    "LABEL_PROP" => "-",
    "OFFERS_CART_PROPERTIES" => array(
      0 => "WINDOW",
      1 => "SPRING_UNIT",
    ),
    "COMPOSITE_FRAME_MODE" => "A",
    "COMPOSITE_FRAME_TYPE" => "AUTO",
    "SECTION_ID" => "",
    "SECTION_CODE" => "",
    "CUSTOM_FILTER" => "",
    "HIDE_NOT_AVAILABLE_OFFERS" => "N",
    "SECTION_ID_VARIABLE" => "SECTION_ID",
    "DISPLAY_COMPARE" => "N",
    "COMPATIBLE_MODE" => "Y"
  ),
  false
);

$selectedSort["FIELD"] can be displayed by id, alphabet, etc.
how can i output products in order according to the order of id in $prod_ids?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
I
Ilya, 2019-02-11
@garmon85

I think it's easier not to puzzle over the filter, but go to the "dream_catalog_section_filter" template and re-sort them in the array according to the sample before displaying the products. The sample itself can be passed to the template through parameters.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question