Home computickets Sorting the Catalog.Section component by array with the desired ID

Sorting the Catalog.Section component by array with the desired ID

Author

Date

Category

Through the search.page component is displayed all the elements IDs that were found in the search, they are written into an array of $ Alelements It turns out an array of the type

array (50) {
 [197819] = & gt;
 String (7) "4495236"
 [204121] = & gt;
 String (7) "4503644"

On this array sets the key in the Filter by ID

global $ searchfilter;
$ searchFilter = Array (
"= Id" = & gt; $ alelements,
"! Catalog_price_1" = & gt; false,
);

And on catalog.section displays the necessary products, but it sorts not as arrays after search.page, I want to sort items in catalog.section through an array of $ alements in which the ID goes in the correct order.
I put in the parameters catalog.section

"element_sort_field" = & gt; "ID",
"Element_SORT_Order" = & gt; $ alelements,

it still does not filter


Answer 1, Authority 100%

In the component, this sorting can be used from update 18.6.900 for IBLock
Sort by array will look in the component as:

"element_sort_field" = & gt; "ID",
"Element_SORT_Order" = & gt; $ alelements,

got the answer from technical support 1C-Bitrix Thank you!

Programmers, Start Your Engines!

Why spend time searching for the correct question and then entering your answer when you can find it in a second? That's what CompuTicket is all about! Here you'll find thousands of questions and answers from hundreds of computer languages.

Recent questions