Invoke search/filter with url

Home Forums Product Support Forums Ajax Search Pro for WordPress Support Invoke search/filter with url

This topic contains 8 replies, has 2 voices, and was last updated by thenetking24 thenetking24 4 years, 6 months ago.

Viewing 9 posts - 1 through 9 (of 9 total)
  • Author
    Posts
  • #23846
    thenetking24
    thenetking24
    Participant

    Hey, thanks again for the great plugin and support!

    Is there any way to pass some info through the URL to activate filters and/or search?

    Kind of like:
    /archive/?filter1=foo&search=bar

    I attempted forcing something like this with JS after the page is loaded and noticed it may not have been responding well to that, is there any code examples for this?

    Thanks again, keep up the great work!

    #23860
    Ernest Marcinko
    Ernest Marcinko
    Keymaster

    Hi!

    Thank you for your kind words!

    Actually, there is a way, it requires some work, but it is possible. Triggering the search is simple, you can read about it here. Presetting the filters is a bit more complicated, as the filters state URL is required, and it can be requested via the plugin API.
    For that, you need to open your browser developer console, and enter this API method there:

    ASP.api(1, 'getStateURL')

    Change the number ‘1’ to the search ID you have, in case it is different. This should print out a URL like so: https://i.imgur.com/prUknH6.png
    That is the URL of the current filter states on the current page. If you change the filters on the current page, and execute the above code again, it will print out those states. Visiting that URL will automatically preset the filters to the given state.

    Now, to trigger the search with the filter state URL, you need to append the ‘asp_s’ query variable to it as well with the given phrase. For example, if the getStateURL returns something like this:

    https://ajaxsearchpro.com/?p_asid=1&p_asp_data=.....

    ..then just append the query variable after the p_asid query variable, like so:

    https://ajaxsearchpro.com/?p_asid=1&asp_s=my phrase&p_asp_data=.....

    ..and that’s it 🙂

    Best,
    Ernest Marcinko

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


    #23905
    thenetking24
    thenetking24
    Participant
    You cannot access this content.
    #23911
    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 :)


    #23929
    thenetking24
    thenetking24
    Participant

    Thank you again.

    Your jQuery test seems to be functioning and returning properly. I just now got a chance to disable all plugins other than yours and the custom post type CPTUI plugin. And I also removed all my .css and .js calls from functions.php in my custom theme based on BlankSlate or one of the other minimal empty wordpress theme packages. Your API & jQuery tests return the same thing no matter what plugins or scripts I do or do not have active.

    I’m at a point where I can clone my theme into a new wordpress install/db and start fresh with your plugin. Let me know if there is anything I can look for before resorting to that, or in the process of rebuilding.

    Thanks a million!

    Attachments:
    You must be logged in to view attached files.
    #23935
    Ernest Marcinko
    Ernest Marcinko
    Keymaster

    Hi,

    I was able to check the site you linked, it was just online. The plugin version seems to be outdated. The console reports an older release number, from april 30, v4.15.2. If you update the plugin, clear the caches, then this issue should be resolved then.

    Best,
    Ernest Marcinko

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


    #24013
    thenetking24
    thenetking24
    Participant

    I feel dumb.

    Thank you for your attention to detail.

    Best support I’ve seen for a plugin/script!

    Thanks again man

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


    #24237
    thenetking24
    thenetking24
    Participant

    Hey, sorry, I didn’t catch your last response. Yes, please close.

Viewing 9 posts - 1 through 9 (of 9 total)

The topic ‘Invoke search/filter with url’ is closed to new replies.