Forums Forums Search & Filter Pro Results displayed: results count + searched tag + associated categories

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

    Dear support team,

    I am looking for a PHP code to insert to show text displayed (only if it is filtered) on top of the results

    Saying:
    Results displayed: 1 – 10 of 21 for “tag” and “category or categories”

    and when the user clicks on the 2nd page of results it needs to show then
    Results displayed: 11 – 20 of 21 for “tag” and “category or categories”

    Example of solution with a different plugin solved like this:
    http://iztokostan.com/stanja/alergije/

    The version of the site with S&F PRO plugin, in a dev. mode i need the PHP code for:
    http://iztokostan.com/testwpsubdomain/domov/?_sft_post_tag=alergije

    I would need this really urgent as I want to change the filter plugin to S&F PRO on the clients site.

    Trevor
    #76957

    I will discuss this with the developer and get back to you.

    Trevor
    #77226

    OK, nearly there. This is the code we have so far:

    <?php
      global $searchandfilter;
      $sf_query = $searchandfilter->get(3217)->current_query();
      if ($sf_query->is_filtered()) {
    ?>
    <div>Found <?php echo $sf_query->found_posts; ?> Results</div>
    <?php
      $sf_current_query = $searchandfilter->get(3217)->current_query()->get_array();
    if (($sf_current_query['_sft_category']['active_terms'][0]['name'])<>"") echo "<div>KATEGORIJE: " . ($sf_current_query['_sft_category']['active_terms'][0]['name']) . "</div>";
    if (($sf_current_query['_sft_post_tag']['active_terms'][0]['name'])<>"") echo "<div>OZNAKE: " . ($sf_current_query['_sft_post_tag']['active_terms'][0]['name']) . "</div>";
    if (($sf_current_query['_sfm_kakovost_spremembe']['active_terms'][0]['name'])<>"") echo "<div>KAKOVOST SPREMEMBE: " . ($sf_current_query['_sfm_kakovost_spremembe']['active_terms'][0]['name']) . "</div>";
    if (($sf_current_query['_sfm_starost']['active_terms'][0]['name'])<>"") echo "<div>STAROST: " . ($sf_current_query['_sfm_starost']['active_terms'][0]['name']) . "</div>";
    if (($sf_current_query['_sfm_vrsta_primera']['active_terms'][0]['name'])<>"") echo "<div>VRSTA PRIMERA: " . ($sf_current_query['_sfm_vrsta_primera']['active_terms'][0]['name']) . "</div>";
    }
    ?>

    And we know that the only part NOT working is:

    <div>Found <?php echo $sf_query->found_posts; ?> Results</div>
    
    Trevor
    #79288

    Marjan, we seem to have successfully coded up the solution for this, using a PHP snippet:

    <?php
      global $searchandfilter;
      $sf_query = $searchandfilter->get(3217)->current_query();
      if ($sf_query->is_filtered()) {
        $sf_current_query = $searchandfilter->get(3217)->current_query()->get_array();
        echo "<b>Prikaz rezultatov za...</b>";
        $cat_string = "";
        foreach($sf_current_query['_sft_category']['active_terms'] as $item) {
          $cat_string .= $item['name'] . ", ";
        }
        $starost_string = "";
        foreach($sf_current_query['_sfm_starost']['active_terms'] as $item) {
          $starost_string .= $item['name'] . ", ";
        }
    if (($sf_current_query['_sft_category']['active_terms'][0]['name'])<>"") echo "<div>PRODUKTI: " . substr($cat_string, 0, -2) . "</div>";
    if (($sf_current_query['_sft_post_tag']['active_terms'][0]['name'])<>"") echo "<div>STANJA: " . ($sf_current_query['_sft_post_tag']['active_terms'][0]['name']) . "</div>";
    if (($sf_current_query['_sfm_kakovost_spremembe']['active_terms'][0]['name'])<>"") echo "<div>KAKOVOST SPREMEMBE: " . ($sf_current_query['_sfm_kakovost_spremembe']['active_terms'][0]['name']) . "</div>";
    if (($sf_current_query['_sfm_starost']['active_terms'][0]['name'])<>"") echo "<div>STAROST: " . substr($starost_string, 0, -2) . "</div>";
    if (($sf_current_query['_sfm_vrsta_primera']['active_terms'][0]['name'])<>"") echo "<div>VRSTA PRIMERA: " . ($sf_current_query['_sfm_vrsta_primera']['active_terms'][0]['name']) . "</div>";
    }
    ?>

    So I will close this now. Great to speak with you on Skype.

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