Home › Forums › Product Support Forums › Ajax Search Pro for WordPress Support › Order results by dropdown
This topic contains 12 replies, has 2 voices, and was last updated by mSchwarz698 2 years, 8 months ago.
- AuthorPosts
- July 13, 2021 at 8:30 am #33916
Hello,
I am very happy with the amazing functionality of this Plugin. I have created some live search filters for taxonomies and they work great.
My question is, if there is a way to let the user order the results by a custom field?
So to have a Dropdown-Menu in the frontend with ‘order by size’ for example and the results will be ordererd by that custom field ‘size’.
Is there a way to do this within the plugin or via some ajax query filters in my functions.php maybe?I hope my question is clear and I hope that you can help me.
Thank you in advance.
Sincererly,
Malte Schwarz
July 13, 2021 at 8:36 am #33917Hi!
Thank you very much for your kind words.
Well, currently there is no way to do that from a front-end drop down. You can set a static primary or secondary results ordering by custom field – both numeric and string types.
It is possible to use the asp_query_args filter to force a custom field ordering programmatically, but that is the same as when you set it on the back-end.We are however planning on adding an ordering feature as soon as the filters section of the plugin finally gets the rework done.
Best,
Ernest Marcinko
If you like my products, don't forget to rate them on codecanyon :)
July 13, 2021 at 8:44 am #33918Thank you for the quick reply.
You probably do not know when this rework is planned?
By setting the asp_query_args and somehow triggering the ajax call, this functionality could be achieved?So setting the asp_query_args on dropdown change and then triggering the filter.
Is there a way to trigger the ajax call programmatically?
Sorry for the very indepth questions. The ordering is a feature my client really wants and I really like to use this plugin.Thanks again in advance.
Malte
July 13, 2021 at 10:01 am #33921It should be the next 6-8 months, depending on how fast we can follow up the current workflow. There are major changes coming soon, so it may take some time.
Well, it is not how it work exactly. The asp_query_args hook let’s you access the query arguments of the search – and change them as you like. In theory you could add a drop-down somewhere (say the ordering drop-down), then append the value somehow to the search form. Then somehow get the value from that argument within the hook and change the ordering accordingly.
Best,
However I don’t know if I can recommend doing this at all. It is extremely time consuming to get it right and may not work whatsoever.
Ernest Marcinko
If you like my products, don't forget to rate them on codecanyon :)
July 19, 2021 at 10:44 am #33980You cannot access this content.July 19, 2021 at 2:34 pm #33992I think so, try changing these options here: https://i.imgur.com/Ehdph2x.png
Best,
It should only allow items matching either of the selected terms.
Ernest Marcinko
If you like my products, don't forget to rate them on codecanyon :)
July 19, 2021 at 2:47 pm #33993You cannot access this content.July 20, 2021 at 8:14 am #34002I think it should still work with radios, that logic automatically applies to them, so normally nothing else should show.
Best,
Can you also try changing these options: https://i.imgur.com/biI5BOa.png
Ernest Marcinko
If you like my products, don't forget to rate them on codecanyon :)
July 20, 2021 at 8:26 am #34003You cannot access this content.July 20, 2021 at 9:34 am #34005It migth not be doable then.
One last thing to try though. On the Advanced Options -> Exclude/Include results, scroll down to the inclusion section – and include only those terms. If all goes well, it should restrict the results to those categories even if nothing is selected.
Best,
Ernest Marcinko
If you like my products, don't forget to rate them on codecanyon :)
July 20, 2021 at 9:47 am #34007Thank you so much. When I include or exclude the taxonomies, or if I even do both it sometimes shows less, but also sometimes nothing.
So it still doen’t work.
I knew it was a very specific request and I want to thank you for your quick help! I still love the Plugin a lot. I hope the sorting will come soon, for the rest I will find a solution.
July 20, 2021 at 9:57 am #34008You cannot access this content. Best,
Ernest Marcinko
If you like my products, don't forget to rate them on codecanyon :)
July 20, 2021 at 9:58 am #34009I will and you can close the topic,yes.
Thank you.
UPDATE:
I know as a developer it is nice to have solutions, so I want to share mine with you, since you have helped me so much and in case a similar question accurs in the future.
I am working with Elementor and a custom Loop. In that Custom loop I have only INCLUDED the posts by the taxonomies I want to show.
-> This solves the problem, that in the beginning of the page-load not only the posts with the right taxonomy are shown.
In Ajax Search Pro Settings I chose the same taxonomies as Radio Buttons to Live-Filter and EXCLUDED all other taxonomies I don’t want to show.
-> this solves the problem that when I click ‘Show All’ that not only the posts with taxonomies I have selected are shown.So include the same taxonomies in the initial loop (in elementor), choose the same taxonomies as live-filter by taxonomy, and exclude all others.
Then only the selected taxonomies are shown from the beginning and if you click ‘show all’.
Just wanted to share with you. Keep up the great work and have a nice day.
Greetings,
Malte
- This reply was modified 2 years, 8 months ago by mSchwarz698.
- AuthorPosts
The topic ‘Order results by dropdown’ is closed to new replies.