Forums Forums Search & Filter Pro Hide results by default

Viewing 8 posts - 1 through 8 (of 8 total)
  • Anonymous
    #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
    #203815

    1. 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
    #203821

    Hi Trevor,

    thanks a lot for your details. I am using the following settings:

    – Display results method: WooCommerce Shop
    – Load results using AJAX: Yes

    Thanks for help!

    Trevor
    #203866

    Ah, you would need to edit your theme’s template for that page, but is the search page also the shop page? That would mean that you shop shows no results until a search is done?

    Anonymous
    #203891

    No, 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
    #203918

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

    Anonymous
    #203947

    Thanks a lot for the details. I will check that and test it.

    Trevor
    #203951

    The 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

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