Forums Forums Search & Filter Pro Plugin doesn't work properly when there are no results

Viewing 4 posts - 1 through 4 (of 4 total)
  • Anonymous
    #10453

    It seems to work quite a bit better when I use the jQuery selector ‘#main’. However, when searching for product tags (I’ve mapped ‘Fotografen’ to tags) or product categories (again, I’ve mapped ‘Edities’ to categories — this is going to be a service for a Dutch local newspaper, we’re intending on selling photos made by our freelance photographers), the entered query doesn’t display. Is there an easy fix for this?

    Kind regards,
    Wouter Spaak

    Ross Moderator
    #10490

    Hey Wouter

    Do you have a link I could look at?

    In a regular template there would normally be a message when no products/results are found – for example (taken from http://codex.wordpress.org/The_Loop):

    <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
    <!-- do stuff -->
    <?php endwhile; else : ?>
    	<p><?php _e( 'Sorry, no posts matched your criteria.' ); ?></p>
    <?php endif; ?>

    So really it sounds like how your template is handling the case when there are no search results.

    Thanks

    Anonymous
    #10492

    It turns out I hooked the results to the wrong DOM Element. When I used #main as my jquery selector, it worked perfectly.

    I also found an easy way to get all search terms in the header:

    ` <?
    function return_search_terms($page_title) {
    if(is_search()) {
    $getText = $_GET;
    $searchString = ”;
    $searchString .= ‘Zoekresultaten: “‘;
    foreach($getText as $key => $value) {
    $searchString .= $value;
    if(end($getText) !== $value) {
    $searchString .= ‘, ‘;
    }
    }
    $searchString .= ‘”‘;
    return $searchString;
    } else {
    return $page_title;
    }
    }

    add_filter(‘woocommerce_page_title’, ‘return_search_terms’);
    ?>

    Ross Moderator
    #10511

    Thanks for the info and glad you’re up and running 🙂

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