Search in header direct to to results page with a search bar

Home Forums Product Support Forums Ajax Search Pro for WordPress Support Search in header direct to to results page with a search bar

This topic contains 2 replies, has 2 voices, and was last updated by fud fud 6 years, 3 months ago.

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #8086
    fud
    fud
    Participant

    Hello,

    I would like to accomplish a certain functionality, but I am not sure how I would go about doing it with the plugin settings.

    What I currently have is a search bar in the header of my site and a search bar on a Catalogue page on my site (note, these two are two different search forms). Right now, I have the 2 column layout on the catalogue page, so the search and filter settings are on the side and the results on the main portion of the page. For the search bar in the header, if I search for something and hit enter, the user is directed to the Results page.

    What I would like to do is have the user be able to search for something in the header and when they click enter, they get directed to the catalogue page with the search results in the main portion of the page already populated. Then, if the user searches in the side bar, the results in the main portion of the page should change accordingly.

    Perhaps I am not going about this the right way, but right now it seems like I am unable to do this because I am using two different search forms and after the user hits enter, I can only direct them to my themes Results page or the first matched option.

    I would greatly appreciate your help with this. Thanks!

    • This topic was modified 6 years, 3 months ago by fud fud.
    #8106
    Ernest Marcinko
    Ernest Marcinko
    Keymaster

    Hi!

    Well, there is actually a way to do something similar since the latest plugin version (4.8.2). It’s not yet documented but it is possible to trigger a specific search instance when calling the right url.

    What I suggest for you to do in this case is:

    On the header search change the Redirect to url? option on the General Options -> Behavior panel to the relative url of the catalogue page + the query parameters.
    This means, that if the catalogue page url is http://yourwebsite.com/catalogue/ , then you need to input:

    catalogue/?asp_id=1&asp_s={phrase}

    Also the asp_id=1 in this pattern refers to the ID of the search you want to trigger. In your case it’s the ID of the search on the Catalogue page. You can find the search ID on the settings page: https://i.imgur.com/4Rm8Nqa.png

    So if the search ID on the catalouge page is 5, then this will change to:

    catalogue/?asp_id=5&asp_s={phrase}

    That’s it. Now when you hit enter the plugin will redirect to the catalogue page instead of the results page and hopefully triggers the catalogue search with the given phrase.

    Best,
    Ernest Marcinko

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


    #8111
    fud
    fud
    Participant

    Awesome, it works! Thanks very much.

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

You must be logged in to reply to this topic.