@garmon85

Как можно вывести товары через компонент catalog.section в заданном порядке?

Добрый день, подскажите пожалуйста, как можно вывести товары через компонент catalog.section в заданном порядке.
Как я пытаюсь реализовать: получаю массив id товаров и передаю их в фильтр
$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"] можно вывести по id, алфавиту, и т.д.
как можно вывести товары в порядке в соответствии с порядком id в $prod_ids?
  • Вопрос задан
  • 388 просмотров
Решения вопроса 1
@jasper-blondin
Думаю, легче не ломать голову над фильтром, а зайти в шаблон "dream_catalog_section_filter" и перед выводом товаров пересортировать их в массиве по образцу. Сам образец можете передать в шаблон через параметры.
Ответ написан
Пригласить эксперта
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Войти через центр авторизации
Похожие вопросы