Search in current product category

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

 
Keymaster
3 years, 2 months ago.

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #19615

    Participant

    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

    #19621

    Hi 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 :)


    #19627

    Participant

    Hi 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
    Thomas

    #19631

    Hi 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 :)


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

You must be logged in to reply to this topic.