Combining multiple orderby parameters in low_search with low_reorder:my_set
Hi Low!
I'm having some issues using low_reorder:my_set as a parameter for odering search results in low_search
My low_search code looks something like this:
{exp:low_search:results query="{segment_2}" limit="100" keywords:mode="exact" status="not closed" require_query="yes" orderby="categorysearch|low_reorder:my_set" sort="asc|asc"}
Now, if i order my results only by either of these parameters, it will work fine, up to a point.
1. If i use only low_reorder:my_set as orderby parameter and select a category during my search, i will get flawless results. Yey!
2. If i don't select a category, i will get no results while using only low_reorder:my_set parameter.
3. If i use "categorysearch" as my orderby parameter, its working as expected, it will order by entries by this custom field (its just a txt input field that holds same value as category name, entries can holy have 1 category)
4. If i use both those parameters as in the example above, my low_reorder:my_set is being completely ignored.
Is it even possible to combine low_reorder:my_set with other fields like this?
Thank you!
Replies
Low 21 Feb 2017 20:41
I'm afraid that using orderby="low_reorder:set_name" will always limit the results by the given set. If you then add a category parameter, only entries in that set that have that category assigned will be displayed. You can't combine the parameter with any other value.
Only way around it is to set the orderby parameter either with JS (using a hidden field) based on what's filled out in the form, or create an extension that will set the orderby parameter, using the low_search_pre_search form.
Malacai 22 Feb 2017 08:09
Thank you for a quick reply!
Would have been great if this worked, but i guess you get the idea what im trying to do, if searching by few parameters.
If category isn't selected, i want to see results ordered first by category, and then by low_reorder wich is single category based.
If it is selected, then results shold again be ordered in same manner, since you allready chose a category, it will only display entries from that one category, and then order them by low_reorder.
I guess ill try a JS solution then, thx Low!