New Landing How can we help? Atelier Remove WooCommerce Gravity Forms from Search

Viewing 15 posts - 1 through 15 (of 17 total)
  • Posted in: Atelier
  • #232583
    seoskyrocket
    Member
    Post count: 32

    The search on the left side of the menu seems to be including information from the WooCommerce Gravity Forms extension, but that inclusion greatly diminishes the effectiveness of the search results. For example, if you search the word “black,” you’ll notice that lots of fabrics display that do not have black in them. The reason is that we use the WooCommerce Gravity Forms extension to allow people who select a fabric to optionally add ribbon to the bulletin board. Because the option to add black ribbons is on every product page as a configuration option, the search results for “black” include every fabric in the entire inventory. Would you guys mind helping me exclude the WooCommerce Gravity Forms extension from the search results? Thank you for your help!

    #232894
    seoskyrocket
    Member
    Post count: 32

    I didn’t get the issue resolved, but I don’t need it resolved anymore because I decided to switch to the Super Search, which alleviated the issue.

    #232913
    seoskyrocket
    Member
    Post count: 32

    Actually, my one remaining issue is that the Super Search currently doesn’t display the full titles of my categories and attributes. For example, if you click the Super Search on the right side of our main menu and then click the [product type] option, you’ll see the word “decorative,” but you’ll see that if you select it the product category is actually “decorative push pins.” Would you guys mind helping me fix that? Thanks!

    #232916
    seoskyrocket
    Member
    Post count: 32

    Okay, well, I’ve come full circle. I love the Super Search, but I’m afraid I may frustrate my clients if that’s the only searching option available, since the Super Search doesn’t allow my clients to perform a traditional search like the “Search” option provides in the Atelier theme. So, I’m back to my original request for the “Search” to exclude the WooCommerce Gravity Forms extension fields. Thanks for your help!

    #232930
    Mohammad – SUPPORT
    Moderator
    Post count: 27441

    Hi,
    Please provide me specific page url with issue.
    Thanks
    Mohammad

    #232931
    seoskyrocket
    Member
    Post count: 32

    The search result happens any time I use the “Search” icon in the header. The affected products are all of the ones in this product category: https://www.pushpinsandfabriccorkboards.com/product-category/fabric-covered-bulletin-boards/

    #232932
    Mohammad – SUPPORT
    Moderator
    Post count: 27441

    Hi,
    Which are the gravity forms products?
    Thanks
    Mohammad

    #233175
    seoskyrocket
    Member
    Post count: 32

    Every product in that category relies upon the WooCommerce Gravity Forms extension. If you click on any product in that category, then you’ll see a list of drop down options that are powered by WooCommerce Gravity Forms extension. The Atelier “Search” is including information from those drop downs, but I’m trying to exclude them because their inclusion renders the “Search” virtually useless.

    #233234
    Mohammad – SUPPORT
    Moderator
    Post count: 27441

    Hi,
    Please paste this code at functions.php of child theme.

    function sf_pre_get_posts( $query ) {
    
       if ( !is_admin() && $query->is_main_query() && $query->is_search() ) {
    
           $query->set( 'post_type', array( 'product' ) );
    
           $tax_query = array(
    
               array(
    
                   // likely what you are after
    
                   'taxonomy' => 'product_cat',
    
                   'field'   => 'slug',
    
                   'terms'   => 'fabric-covered-bulletin-boards',
    
                   'operator' => 'NOT IN',
    
               ),
    
           );
    
           $query->set( 'tax_query', $tax_query );
    
    }
    
    }
    
    add_action( 'pre_get_posts', 'sf_pre_get_posts' );

    Thanks
    Mohammad

    #233255
    seoskyrocket
    Member
    Post count: 32

    Thanks for your help. I tried that, but it produced a 500 server error on my site, claiming that there is an extra semicolon on this line:

    if ( !is_admin() && $query->is_main_query() && $query->is_search() ) {

    #233260
    Mohammad – SUPPORT
    Moderator
    Post count: 27441

    Hi,
    Please install WPIDE plugin and let me know. I will check it further.
    Thanks
    Mohammad

    #233467
    seoskyrocket
    Member
    Post count: 32

    I have installed the plugin.

    #233851
    Mohammad – SUPPORT
    Moderator
    Post count: 27441

    Hi,
    I have managed to resolve so please check it now.
    Thanks
    Mohammad

    #234040
    seoskyrocket
    Member
    Post count: 32

    Thank you for your work. It doesn’t appear to be resolved, as a search for the word “black” shows a purple and white fabric as its first search result. I looked through the product description of the purple and white fabric and the word black is not used, but I did find it in the source code in the name of one of the images. So, it looks like the search functionality may be pulling from the image URLs. If we can exclude image titles, descriptions, alt tags, etc. from the search, then I bet that will fix the issue. Thank you for your help!

    #234775
    Mohammad – SUPPORT
    Moderator
    Post count: 27441

    Hi,
    Please paste this code at functions.php of child theme.

    add_action( 'init', 'exclude_images_from_search_results' );
    function exclude_images_from_search_results() {
    	global $wp_post_types;
    
    	$wp_post_types['attachment']->exclude_from_search = true;
    }

    Thanks
    Mohammad

Viewing 15 posts - 1 through 15 (of 17 total)

You must be logged in and have valid license to reply to this topic.

License required for one of the following items
Login and Registration Log in · Register