WooCommerce Product Variations Shown

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 Ernest Marcinko 9 years, 6 months ago.

Viewing 12 posts - 1 through 12 (of 12 total)
  • Author
    Posts
  • #2193
    diego89
    diego89
    Participant

    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?

    #2194
    diego89
    diego89
    Participant

    Screenshots

    Attachments:
    You must be logged in to view attached files.
    #2197
    Ernest Marcinko
    Ernest Marcinko
    Keymaster

    Hi!

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


    #2382
    mistercyril
    mistercyril
    Participant

    I have the same problem even though I didn’t include “product_variation” in “search in custom post types”.

    #2385
    diego89
    diego89
    Participant

    I’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 BY

    the 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.

    #2388
    Ernest Marcinko
    Ernest Marcinko
    Keymaster

    Hi!

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


    #2390
    mistercyril
    mistercyril
    Participant

    Hello 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.

    #2392
    Ernest Marcinko
    Ernest Marcinko
    Keymaster

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


    #2398
    mistercyril
    mistercyril
    Participant

    Basic 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)

    #2401
    Ernest Marcinko
    Ernest Marcinko
    Keymaster

    Hi!

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


    #2403
    mistercyril
    mistercyril
    Participant

    Yes 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.

    #2404
    Ernest Marcinko
    Ernest Marcinko
    Keymaster

    Oh. 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 :)


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

You must be logged in to reply to this topic.