Order results by dropdown

This topic contains 12 replies, has 2 voices, and was last updated by mSchwarz698 mSchwarz698 2 years, 8 months ago.

Viewing 13 posts - 1 through 13 (of 13 total)
  • Author
    Posts
  • #33916
    mSchwarz698
    mSchwarz698
    Participant

    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

    #33917
    Ernest Marcinko
    Ernest Marcinko
    Keymaster

    Hi!

    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 :)


    #33918
    mSchwarz698
    mSchwarz698
    Participant

    Thank 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

    #33921
    Ernest Marcinko
    Ernest Marcinko
    Keymaster

    It 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.
    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.

    Best,
    Ernest Marcinko

    If you like my products, don't forget to rate them on codecanyon :)


    #33980
    mSchwarz698
    mSchwarz698
    Participant
    You cannot access this content.
    #33992
    Ernest Marcinko
    Ernest Marcinko
    Keymaster

    I think so, try changing these options here: https://i.imgur.com/Ehdph2x.png
    It should only allow items matching either of the selected terms.

    Best,
    Ernest Marcinko

    If you like my products, don't forget to rate them on codecanyon :)


    #33993
    mSchwarz698
    mSchwarz698
    Participant
    You cannot access this content.
    #34002
    Ernest Marcinko
    Ernest Marcinko
    Keymaster

    I think it should still work with radios, that logic automatically applies to them, so normally nothing else should show.
    Can you also try changing these options: https://i.imgur.com/biI5BOa.png

    Best,
    Ernest Marcinko

    If you like my products, don't forget to rate them on codecanyon :)


    #34003
    mSchwarz698
    mSchwarz698
    Participant
    You cannot access this content.
    #34005
    Ernest Marcinko
    Ernest Marcinko
    Keymaster

    It 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 :)


    #34007
    mSchwarz698
    mSchwarz698
    Participant

    Thank 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.

    #34008
    Ernest Marcinko
    Ernest Marcinko
    Keymaster
    You cannot access this content. Best,
    Ernest Marcinko

    If you like my products, don't forget to rate them on codecanyon :)


    #34009
    mSchwarz698
    mSchwarz698
    Participant

    I 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 mSchwarz698.
Viewing 13 posts - 1 through 13 (of 13 total)

The topic ‘Order results by dropdown’ is closed to new replies.