Home › Forums › Product Support Forums › Ajax Search Pro for WordPress Support › Search in current product category
This topic contains 3 replies, has 2 voices, and was last updated by Ernest Marcinko 4 years, 5 months ago.
- AuthorPosts
- October 24, 2018 at 9:29 pm #19615
Hello,
We are using AjaX Search Pro on our website and are really happy with it.
I would love to offer our users the possibility to search for products within the current product category. Since we have quite a few categories ( approx. 50) it is not an option for us to have the user choose the specific category from a dropdown.
Is there any way to limit the search to the current product category only?
Or even better, is there a way to limit the search to the filtered products in the product page? Maybe an example explains best what I mean:
The user looks at the product category rings. He uses the woocommerce product attribute filters to get only rings with the material gold. Is there any way to implement a search form that enables the user to search within these gold rings for rings with diamonds?I am pretty sure that there is no backend option for this and that some coding will be needed. Thats no problem, I am willing to go through it. I just would appreciate any help that points me in the right direction and gives me a start.
Thanks for your help!
Thomas
October 25, 2018 at 1:45 pm #19621Hi Thomas,
The first one should be actually possible. There is this knowledge base article, that explains how to do this with posts and categories, I will try to construct a custom code based on that.
This should be very close to a possible solution:
Best,
Ernest Marcinko
If you like my products, don't forget to rate them on codecanyon :)
October 25, 2018 at 7:48 pm #19627Hi Ernest,
thx for the fast reply.
It seems to work fine.
When I copy it in the functions.php file It is used by all search instances.
Is there a way to limit it to a certain search instance?Regards
ThomasOctober 26, 2018 at 8:40 am #19631Hi Thomas,
It is actually possible:
Just change the $search_instance variable on line 7 to the search instance on which you want this code to be applied on.
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.