Home › Forums › Product Support Forums › Ajax Search Pro for WordPress Support › WooCommerce Product Variations Shown
This topic contains 11 replies, has 3 voices, and was last updated by Ernest Marcinko 9 years, 2 months ago.
- AuthorPosts
- August 14, 2014 at 3:44 pm #2193
Hi, I’m trying to make the WooCommerce search with your plugin. Badly, it shows me all the time the variations of a product. I disabled the search for variations as you can see on the screenshots.
Do you have a fix for this?
August 14, 2014 at 3:45 pm #2194August 14, 2014 at 3:52 pm #2197Hi!
If the variations were enabled before, it might have been cached. If the search cache is enabled, please disable it and see if it works then.
Also, if you have other cache plugins (like w3tc or super cache) you should try to empty the cache of those plugins as well. Let me know if it worked.If it’s not hepling, then please link me to the page where it’s happening, and I will take a look at the output.
Best,
Ernest Marcinko
If you like my products, don't forget to rate them on codecanyon :)
September 8, 2014 at 8:31 pm #2382I have the same problem even though I didn’t include “product_variation” in “search in custom post types”.
September 9, 2014 at 6:27 am #2385I’ve got a permanent fix for you:
In Includes -> search_content.class on line 210 there is the query $querystr = …
change the WHERE statement to:
WHERE
$post_types
AND $post_statuses
AND $like_query
AND $exclude_posts
AND NOT $wpdb->posts.post_type = ‘product_variation’
GROUP BYthe AND NOT line is my change in this file, probably you have to change the search_content_fulltext.class aswell.
It hope it works for you aswell.
September 9, 2014 at 8:47 am #2388Hi!
You were both right and I have found the cause if this problem. There was an error in the query, and the search looked for ever custom post type that matched “product”. Luckily it’s a minor issue, and it only happens in this case, but here is the solution:
1. open up the plugins/ajax-search-pro/includes/search_content.class.php file and go to line 46 to 49 you should see this:
} else { $words = implode('|', $types); $post_types = "($wpdb->posts.post_type REGEXP '$words')"; }
2. replace that code with:
} else { $words = implode('[[:>:]]|[[:<:]]', $types); $post_types = "($wpdb->posts.post_type REGEXP '[[:<:]]".$words."[[:>:]]')"; }
I just run a few tests on the test server, and it worked fine.
I will upload this fix to codecanyon as soon as possible as well. Thank you for reporting this issue, and sorry for the inconvenience!
Best,
Ernest Marcinko
If you like my products, don't forget to rate them on codecanyon :)
September 9, 2014 at 9:05 am #2390Hello Ernest,
I just implement the fix you provided (thank you for the quick response BTW). Unfortunately I am still seeing “Variation #XXX of Product name…” in suggestions…
I cleared the cache and refreshed the page.
Any ideas as what I might have missed?
Thanks,
C.September 9, 2014 at 9:10 am #2392I think I do. I forgot to mention that if you use fulltext search, then this needs to be copied there as well.
Open up the search_content_fulltext.class.php file in the same directory as before, and go to lines 45-48, you should see exactly the same code as before:
} else { $words = implode('|', $types); $post_types = "($wpdb->posts.post_type REGEXP '$words')"; }
and replace it as before:
} else { $words = implode('[[:>:]]|[[:<: ]]', $types); $post_types = "($wpdb->posts.post_type REGEXP '[[:<: ]]".$words."[[:>:]]')"; }
I hope it finally solves the problem.
Best,
Ernest Marcinko
If you like my products, don't forget to rate them on codecanyon :)
September 9, 2014 at 10:03 am #2398Basic search results
Actually, its not finding any results at all now.I really don’t understand how search works because it randomly picks up some results for a given search term sometimes, yet leaves them out a few minutes later.
At the moment its decided not to find anything at all. The only thing I have changed is disabled “full-text” search and cleared the cache…
Search term suggestions
Also, I set search term suggestions to be based on search statistics but its still pulling in what looks like Google search terms that are absolutely not relevant to the scope of the site I am working on.This looks like another case of settings not being registered in the front-end (i.e. disabling front-end search settings).
Do you have any thoughts as to what might be going on?
(P.S. I would have liked to create separate tickets but the ticket creation form says my licence key is already in use)
September 9, 2014 at 10:37 am #2401Hi!
As I examined closely the code I sent you, it looks like the forum put a few extra spaces in it – yet that’s not what I copy pasted here. I will rather attach the fixed and packed plugin to this post, rather then copy pasting the code here. All you need to do deactivate the old one, delete it, install this one and save the settings once again, just to make sure.
As for the keywords: Do you have the search statistics activated? Because it’s disabled by default. If so, then try to de-activate and activate it again. Hopefully it’s just some kind of inconsistency of the settings towards the front-end.
Also, don’t forget, that there are two types of “keyword suggestions”:
First is the autocomplete, which can use the search statistics database or google as the source – this triggers while typing.
The second is the keyword suggestions when no results are found – this shows a dropdown when there are no results, but can only use google, not the statistics database. (hopefully in the future I can work out something to use the statistics as well)I’m saying this, because a while ago someone mixed up the two options, and indeed it can be confusing because of the similar functions.
Best,
Ernest Marcinko
If you like my products, don't forget to rate them on codecanyon :)
September 9, 2014 at 11:39 am #2403Yes you are right about the fact that I confused auto complete and search suggestions. So I just disabled search suggestions and all is good on that front.
About the plugin fix, I’m sorry but I can’t see the file you uploaded… there is a message saying :
ATTACHMENTS:
You can’t view files in this topic.Lastly, I would really like to disable front-end search settings but like I said, no matter what I do in the back-end, the front-end icon and drop-down are still always there. Do you know what can be done to fix this?
Thank you for your great support.
Cheers,
C.September 9, 2014 at 11:43 am #2404Oh. Could you please open a topic, I didn’t see someone else opened this one, that’s why you can’t see the attachements – it’s only visible for the owner and me.
As for the front end drop down. If you disable everything on the Frontend search settings panel it will disappear. But the version I will attach to your new topic includes an option to hide the options panel.
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.