Home › Forums › Product Support Forums › Ajax Search Pro for WordPress Support › Auto Select/Trigger Filters
This topic contains 1 reply, has 2 voices, and was last updated by Ernest Marcinko 4 years, 7 months ago.
- AuthorPosts
- January 8, 2020 at 10:16 pm #25239
Hi,
I’m wanting to trigger the filtering options (check boxes) depending on the link. Here’s how it works now: Resources page – http://www.buildingmovement.bcdcideasclient.com/tools-reports-resources/ has all the filters checked.
I want to link the Reports page – http://www.buildingmovement.bcdcideasclient.com/learn/reports/ to the Resources page, but have only the “Content Type” filter only have Reports checked.
I have several other types of filter combos I want to use, but this is a good first start.
Does that make sense? Or is there a better way to go about this?
Brian
January 9, 2020 at 10:55 am #25243Hi Brian,
There is an API call, that can give you the ‘state URL’ of the current search, which is basically what you are looking for. 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/Ki2nv5c.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/Vzbqsj0.png
3. Now, enter the following code to the console input:
ASP.api(1, 1, 'getStateURL');
..and then hit the enter key to execute it. It should return something like this: https://i.imgur.com/dN5jDJL.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 🙂
Best,
Ernest Marcinko
If you like my products, don't forget to rate them on codecanyon :)
- AuthorPosts
You must be logged in to reply to this topic.