[resolved] Customizing the search template (2 posts)

  1. coding4fun
    Posted 3 years ago #

    The search template has a place to enter a string, and the search results return products that contain that string. My first question is: How do you search by category? My second question is: say I have product variations on some items, such as "size" with S,M,L. How can I search for all smalls? These would be drop downs.

    Finally, this would need to work together - I'm searching in the category "skirts" for all "smalls" and I'm getting the correct and total results.

    Hope you can help!


  2. sparkweb
    Plugin Author

    Posted 3 years ago #

    This will take some customized coding. I'd recommend that you look at customposttype.php around lines 206-215 for some code to make a dropdown of all categories. In your actual product search you would do something like "product_categories" => YOURSEARCHVALUE. That may take some tweaking.

    The variation is a little trickier. It's stored as a custom field and it's all serialized inside of _variations so you could search for a custom field with the name _variations that contains a value "small" or something like that.

    WordPress search is not too customizable so if you can't get it working you might have to roll a custom query using $wpdb.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic