-
AuthorSearch Results
-
February 25, 2016 at 3:13 pm #37944
In reply to: Site crashed after updating to 2.0.1
AnonymousInactiveHello Ross.
First I want to say thank you for helping me.
I added this:
add_filter(‘body_class’,’add_body_class_to_search_filter’);
function add_body_class_to_search_filter($classes) {global $searchandfilter;
if($searchandfilter->active_sfid()){
$classes[] = “tax-product_cat archive woocommerce woocommerce-page alt-style-default boxed-layout two-col-right width-930 two-col-right-930”;
}
// return the $classes array
return $classes;
}and it is still crashing my staging site. Anything else that needs to be changed?
Thanks
February 24, 2016 at 7:43 pm #37853In reply to: Site crashed after updating to 2.0.1
AnonymousInactiveHello Again.
So if there is no way to use the Woocommerce display and remove the “shop” part of the URL I am stuck with the archive method. Only issue is when I follow your instructions to remove $sf_form_data with $searchandfilter like below:
add_filter(‘body_class’,’add_body_class_to_search_filter’);
function add_body_class_to_search_filter($classes) {global $searchandfilter;
if ($searchandfilter->is_valid_form())
{
$classes[] = “tax-product_cat archive woocommerce woocommerce-page alt-style-default boxed-layout two-col-right width-930 two-col-right-930”;
}
// return the $classes array
return $classes;
}it still breaks my staging site, what else do I need to fix to get it to work properly? I tried only replacing the first instance of $sf_form_data with $searchandfilter and that didn’t work either.
Thanks
September 23, 2015 at 6:42 pm #25607In reply to: Site crashed after updating to 2.0.1
AnonymousInactiveI have this in the functions file –
add_filter(‘body_class’,’add_body_class_to_search_filter’);
function add_body_class_to_search_filter($classes) {global $sf_form_data;
if ($sf_form_data->is_valid_form())
{
$classes[] = “tax-product_cat archive woocommerce woocommerce-page alt-style-default boxed-layout two-col-right width-930 two-col-right-930”;
}
// return the $classes array
return $classes;
}line 105 is:
if ($sf_form_data->is_valid_form())
August 15, 2015 at 8:33 pm #23293In reply to: WooCommerce Results Page Problems
AnonymousInactiveSo I have sort of figured this out – the body classes –
Search and Filter Search Results Page –
<body class=”blog gecko alt-style-default boxed-layout two-col-right width-930 two-col-right-930″>
Woocommerce Archive Product Results Page –
<body class=”archive tax-product_cat term-afghan term-297 woocommerce woocommerce-page gecko alt-style-default boxed-layout two-col-right width-930 two-col-right-930″>
So the Search and Filter template needs those body classes that are missing, I see the code in your link but just so I don’t mess anything up can you confirm what the code should look like in my case?
Thanks so much for your help!
John
May 19, 2015 at 7:20 am #17834Topic: Template for woocommerce
in forum Search & Filter Pro
AnonymousInactiveHi Ross 🙂
I read in this forum that the best template to use for woocommerce is archive-product.php.
I’m using the shortcode method, but I don’t understand if I have to modify my results.php page in order to look like archive-product.php (using woocommerce functions, such as do_action( ‘woocommerce_before_shop_loop’)) or if it’s simply a matter of css.
Now my search works, but the results are in list and not in grid.I’m trying to understand by reading your guide here
https://support.searchandfilter.com/forums/search/woocommerce-page/Is it a good start? 🙂
May 8, 2015 at 5:40 pm #17059In reply to: WP 4.2.1 update affecting plugin
RossKeymasterHi Paul
I’ve had a quick look… the problem seems to be the wrong CSS is being applied to the search results page.
As I mentioned before ,these customisations are normally out of scope of support, but I think I’ve cracked it anyway.
Essentially, on your shop page, the
bodytag has the following classwoocommerce-page(amongst others).When I add these in firebug to the search results page, the results look like a grid – not sure if its exactly the same, but very similar…
So what you need to do is add some wordpress code to add these two classes to your body tags, on search result pages (take from: https://support.searchandfilter.com/forums/search/woocommerce-page/):
add_filter('body_class','add_body_class_to_search_filter'); function add_body_class_to_search_filter($classes) { global $sf_form_data; if ($sf_form_data->is_valid_form()) { $classes[] = "woocommerce-page"; } // return the $classes array return $classes; }You can add this to the
functions.phpof your theme.Hope that helps!
January 8, 2015 at 1:04 pm #9931In reply to: Woocommerce integration
RossKeymasterHey Janno
I would say this is a theme specific issue and not a plugin issue. I generally do not provide support for customising your theme template files – as these are more to do with your theme than the plugin – for example you can use this template anywhere in your theme (that is not the product archive) and I’m sure you would find similar results/problems.
However, that being said, the first thing to do with this kind of problem is check what the differences are between these two pages.
So I had a quick look at the source of the both the pages – although very similar there is one big difference.
If you take a look at the opening body tag you will notice the woocommerce page formatted in a grid has the class
woocommerce-pageand the results page does not.I added it via the dom inspector to http://vanka.magicservices.nl/producten and the grid works 🙂
So there are two approaches to fixing this – the first – edit your css rules so the grid classes are also applied to the Search & Filter results page…
or
Add this class to the body tag on your results page 🙂 This option is easier and only requires copying and pasting some code into
functions.php:add_filter('body_class','add_body_class_to_search_filter'); function add_body_class_to_search_filter($classes) { global $sf_form_data; if ($sf_form_data->is_valid_form()) { $classes[] = "woocommerce-page"; } // return the $classes array return $classes; }Hope that helps!
-
AuthorSearch Results
Viewing 7 results - 1 through 7 (of 7 total)
-
Search Results
-
Topic: Template for woocommerce
Hi Ross 🙂
I read in this forum that the best template to use for woocommerce is archive-product.php.
I’m using the shortcode method, but I don’t understand if I have to modify my results.php page in order to look like archive-product.php (using woocommerce functions, such as do_action( ‘woocommerce_before_shop_loop’)) or if it’s simply a matter of css.
Now my search works, but the results are in list and not in grid.I’m trying to understand by reading your guide here
https://support.searchandfilter.com/forums/search/woocommerce-page/Is it a good start? 🙂
Viewing 7 results - 1 through 7 (of 7 total)