Digital experiences for all disciplines
New Landing › How can we help? › Atelier › Remove WooCommerce Gravity Forms from Search
New Landing › How can we help? › Atelier › Remove WooCommerce Gravity Forms from Search
- This topic has 16 replies, 3 voices, and was last updated 8 years by David Martin – Support.
-
Posted in: Atelier
-
December 2, 2015 at 2:02 am #232583
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!
December 2, 2015 at 11:49 pm #232894I 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.
December 3, 2015 at 3:56 am #232913Actually, 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!
December 3, 2015 at 6:56 am #232916Okay, 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!
December 3, 2015 at 8:31 am #232930Hi,
Please provide me specific page url with issue.
Thanks
MohammadDecember 3, 2015 at 8:35 am #232931The 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/
December 3, 2015 at 8:44 am #232932Hi,
Which are the gravity forms products?
Thanks
MohammadDecember 3, 2015 at 7:38 pm #233175Every 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.
December 4, 2015 at 5:56 am #233234Hi,
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
MohammadDecember 4, 2015 at 8:01 am #233255Thanks 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() ) {
December 4, 2015 at 8:09 am #233260Hi,
Please install WPIDE plugin and let me know. I will check it further.
Thanks
MohammadDecember 4, 2015 at 11:54 pm #233467I have installed the plugin.
December 8, 2015 at 7:47 am #233851Hi,
I have managed to resolve so please check it now.
Thanks
MohammadDecember 8, 2015 at 9:35 pm #234040Thank 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!
December 11, 2015 at 5:36 am #234775Hi,
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 -
Posted in: Atelier
You must be logged in and have valid license to reply to this topic.