V
V
Vitaly2018-04-05 10:23:45
1C-Bitrix
Vitaly, 2018-04-05 10:23:45

Is it possible to apply different sortings in one component, depending on the properties?

Good afternoon.
The task is as follows - it is necessary to fasten the button "up to raise the object to the top of the catalog". Started property up, I put a daw.

if(empty($arrFilter)&&empty($sortBy)) {//только при пустом фильтре и сортировке
  $sortBy='property_up';
  $orderBy='desc';
}
$intSectionID = $APPLICATION->IncludeComponent(
  "bitrix:catalog.section",
  "catalog_" . (isset($currentSection) ? $templateView : 'cards'),
      array(
   "IBLOCK_TYPE" => $arParams["IBLOCK_TYPE"],
   "IBLOCK_ID" => $arParams["IBLOCK_ID"],
   "ELEMENT_SORT_FIELD" => $sortBy,
   "ELEMENT_SORT_ORDER" => $orderBy,
   "ELEMENT_SORT_FIELD2" => $arParams["ELEMENT_SORT_FIELD2"],
   "ELEMENT_SORT_ORDER2" => $arParams["ELEMENT_SORT_ORDER2"],

Everything works as desired.
There was a second task - to sort "raised objects" randomly, subsequent by date in descending order.
And then I got lost .....
Tell me, is it possible to apply different sortings in one component, depending on the property.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
N
Nikita, 2018-04-05
@Rema1ns

It is impossible in one component, it is better to duplicate the component for the lifted goods, throw the filter + sorting into it.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question