Home › Forums › Product Support Forums › Ajax Search Pro for WordPress Support › Triggering a search by url with additional term filters
- This topic has 8 replies, 2 voices, and was last updated 7 years, 10 months ago by
DavidH.
-
AuthorPosts
-
July 25, 2018 at 12:13 pm #18774
DavidH
ParticipantHi,
I’m wondering if it’s possible to trigger a search by url as described here: https://wp-dreams.com/knowledge-base/trigger-search-via-an-url/
But… add category/terms parameters to that search so something like:https://www.allen-heath.com/document-library/?asp_id=1&asp_s=technical datasheet&att-tag-term=dlive
I saw in a discussion on Envato a year ago, that you agreed this would be a good feature request but I’m guessing you havent implemented it so far.
Would love to hear if you plan to make any progress with that.
Thanks for a fantastic plugin by the way! It’s amazing!
All the best
DavidJuly 25, 2018 at 3:41 pm #18776Ernest Marcinko
KeymasterHi David,
Thank you very much for your kind words!
For the custom field filters it is now possible, the taxonomy term part is not ready yet. However there is an API call, that can give you the ‘state URL’ of the current search, which is basically what you are looking for. The downside of this is, that it cannot be easily modified as it is base64 encoded. This state URL can be requested via the javascript console.
To get a URL to a specific search state, do the following:
1. Set up the search filters as you need them. In this example I have selected the following filters: https://i.imgur.com/914TuSP.png2. Open your developer console. In Google Chrome browsers you need to hit the F12 button once, and a window will open on the bottom of the browser window. Make sure to navigate to the ‘console’ tab there, it should look like this: https://i.imgur.com/H9a2hGW.png
3. Now, enter the following code to the console input:
[code]ASP.api(1, 1, ‘getStateURL’);[/code]
..and then hit the enter key to execute it. It should return something like this: https://i.imgur.com/W72RSQA.png
4. That is the state URL of the current search filters and input. You can right click to copy it. Using that URL will open the same exact page with these exact filters selected.
In my case this URL was exactly this.You can use this method to generate any states, then copy the URLs. If you visit these URLs the search is re-created with the filters and the search phrase chosen.
I hope this helps 🙂
July 25, 2018 at 3:59 pm #18777DavidH
ParticipantErnest. You are a legend! That worked perfectly!
Thank you so much!
I’m getting a “More Results (9)” and I’m not sure why though… I’ll probably figure that out… seem to only get 10 results listed with the URL search.
Hmmmm…Thanks
DavidJuly 25, 2018 at 4:59 pm #18778Ernest Marcinko
KeymasterYou cannot access this content.
July 26, 2018 at 11:50 am #18782DavidH
ParticipantHi Ernest,
Sorry more questions regarding this. Using this method I only get 10 results returned and clicking on “More Results (9)” isnt working.
I’m wondering if there’s a wordpress filter somewhere that’s limiting the results but I cant find it.Any thoughts?
Thanks
David-
This reply was modified 7 years, 10 months ago by
DavidH.
July 27, 2018 at 10:13 am #18789Ernest Marcinko
KeymasterHi David,
That might possibly be a minor bug due to the difference of number of results between the auto-populate and the regular results limit.
Can you please try changing the auto-populate results limit to the same number as the regular results limit:
– auto-populate limit: https://i.imgur.com/9gQ7Nay.png
– results limit: https://i.imgur.com/E1hXcwN.png
I think if you set both of these to the same number, then the ‘more results’ link should start working as well.July 27, 2018 at 10:21 am #18790DavidH
ParticipantYou hero!! Set both of those to 100 and now working perfectly!
Off to rate the plugin 5 stars on codecanyon.
Thank you so much!
David
July 27, 2018 at 10:27 am #18791Ernest Marcinko
KeymasterYou cannot access this content.
July 27, 2018 at 10:29 am #18792DavidH
ParticipantYep. Close it. I’ve got it working just how I need it now. Thank you again Ernest 🙂
-
This reply was modified 7 years, 10 months ago by
-
AuthorPosts
- The topic ‘Triggering a search by url with additional term filters’ is closed to new replies.