Can't get results to filter

Forums › Forums › Search & Filter Pro › Can't get results to filter

Viewing 10 posts – 1 through 10 (of 16 total)
  • Anonymous
    #166306

    Hi there

    I wonder if you can help at all? This is the page I am having issues with: http://dd-server.co.uk/vinetrail/producers/

    The custom post type (Producers) that is being filtered has two taxonomies – Country and Region. I want to filter using AJAX by Country only but I need the results to be grouped by Region, as currently shown via the collapsible divs.

    Currently when I check the box for Spain, it looks like it’s loading the results but all posts are still shown and no filtering is actually taking place.

    I am using a custom template with a WP_Query and have added the search filter ID but not entirely sure I have done this correctly.

    Trevor
    #166395

    On the Display Results tab, look for the Ajax Container (currently set to #main) and set that to #producer-list and try that.

    Anonymous
    #166407

    No, that hasn’t worked.

    Anonymous
    #166422

    This is my query, does this help?

    $producers_query = new WP_Query( array(
    ‘post_type’ => ‘producers’,
    ‘orderby’ => ‘title’,
    ‘order’ => ‘ASC’,
    ‘tax_query’ => array(
    array(
    ‘taxonomy’ => ‘producer_region’,
    ‘field’ => ‘slug’,
    ‘terms’ => array( $region_group_term->slug ),
    ‘operator’ => ‘IN’
    )
    ),
    ‘search_filter_id’ => 788
    ) );

    Trevor
    #166428

    What is the results URL set to in the form?

    Anonymous
    #166431

    Oops! I thought because it was AJAX and loading on the same page that it didn’t need a URL. Now it works! Thank you!

    I do have a couple more queries, (sorry to be a pain). Now it is working, it still shows all of the taxonomy terms rather than just showing the ones relevant to the search results, it there a way to only show the taxonomy terms that have filtered results in?

    Also, at the top of the page, just above the search form I need it to show the current filter that is active and be able to clear the filters by clicking on CLEAR ALL – I did have a look through the forums so I believe this is possible, but I didn’t really understand now to implement this.

    Anonymous
    #166433

    Also, I seem to have lost the collapsible div functionality when the results are showing.

    Anonymous
    #166436

    By the way, I have set the URL to http://dd-server.co.uk/vinetrail/producers but it says the shortcode must be included, where would I put that?

    Trevor
    #166438

    If you are setting the collapsible div functionality you need to reset it when Ajax triggers, like this (put your code instead of the comment):

    <script>(function ( $ ) {
      "use strict";
      $(document).on("sf:ajaxfinish", ".searchandfilter", function(){
        console.log("ajax complete");
    // load your div code here
      });
    }(jQuery));</script>

    If you have the Custom display results method, I am not sure what that error message is. Can you screenshot it, upload it to an image sharing site, and give me the link?

    Anonymous
    #166448

    Hmmm, that just seems to break it and show nothing apart from the search box.

    Which error message are you referring to?

Viewing 10 posts – 1 through 10 (of 16 total)
Search & Filter Support
Privacy Overview

This website uses cookies so that we can provide you with the best user experience possible. Cookie information is stored in your browser and performs functions such as recognising you when you return to our website and helping our team to understand which sections of the website you find most interesting and useful.

We also use cookies to store items in your cart as well as allowing your to login on the site.

You can adjust all of your cookie settings by navigating the tabs on the left hand side.

By continuing to use this site, you also agree to our Privacy Policy.