Forums › Forums › Search & Filter Pro › Hide results by default
- This topic has 7 replies, 2 voices, and was last updated 5 years, 8 months ago by Trevor.
-
Anonymous(Private) March 4, 2019 at 11:13 am #203809
Hello,
first of all… I love Search & Filter Pro. It just works as expected. Love it!!!
I’ve got just two questions…
1) I am using Search & Filter Pro on our WooCommerce shop. Is it possible to hide the results by default and show them only after the user has made some changes on the filter/in the search form?2) Is it possible to display a price filter (range radio buttons). Something like that:
USD 0–10
USD 10–20
USD 20 or more?I do not want to display every range (the highest price is USD 220.–, and I don’t want to use a step of USD 10.– for the first two radio buttons)
Thanks for help!!
Trevor(Private) March 4, 2019 at 12:06 pm #2038151. Which Display Results Method are you using?
2. At present, the only way to do this would be to have a separate custom field that held one of these three options, and that field would be populated by some PHP in your child theme functions.php file using the WordPress save_post() function to work out which value to place in that field. This would run every time you save the product, but would not go back and add data for existing products.Anonymous(Private) March 4, 2019 at 7:58 pm #203891No, the search page isn’t also the shop page.
Yes, I want to build something like a shopping guide, where you select some attributes and after pressing the button “Confirm selection” the results will be shown.
Maybe I will try to hide the default product list (that is shown by default, before the user has pressed the button) with CSS.
Trevor(Private) March 5, 2019 at 9:44 am #203918What template is your search page using? The issue with using the WooCommerce display results method is that, by default, it redirects back to shop page.
Whilst it may need additional coding, the Shortcode display results method allows you to stay on your shopping guide page, AND (with some simple code tweaks) allows a blank no results showing until the filter is used.
It allows you to edit the results.php template and pretty much copy and paste code from an existing template to get the look and feel of your theme.
Trevor(Private) March 5, 2019 at 11:59 am #203951The hide results code is like this:
global $searchandfilter; $sf_current_query = $searchandfilter->get(36613)->current_query(); if ((!$sf_current_query->is_filtered())&&($sf_current_query->get_search_term()=="")) { echo '<div>Nothing to see here folks!</div>'; } else { // your current results.php code here }
… where the ID number will need to be changed to match your form ID
-
AuthorPosts