Support Forums

The forums are closed and will be removed when we launch our new site.

Looking for support? You can access the support system via your account.

Forums Forums Search & Filter Pro How to style the search data

Viewing 10 posts - 11 through 20 (of 30 total)
  • Trevor Moderator
    #43625

    Hi, can you try this code (it might be a step backwards, but bear with me):

    global $searchandfilter;
    $sf_current_query = $searchandfilter->get(339)->current_query();
    echo $sf_current_query->get_field_string("_sft_length", array("str" => "%2$s");
    echo $sf_current_query->get_field_string("_sft_rate", array("str" => "%2$s");
    echo $sf_current_query->get_field_string("_sft_guest", array("str" => "%2$s");
    echo $sf_current_query->get_field_string("_sft_location", array("str" => "%2$s");
    echo $sf_current_query->get_field_string("_sft_toy", array("str" => "%2$s");
    cascadegroup
    #43630

    Thanks for this code, I had to adjust the code to add extra closing brackets for the STRING (below), unfortunately this results in the same data being given.

    “Yacht Length: 40-50m”

    <?php
    global $searchandfilter;
    $sf_current_query = $searchandfilter->get(339)->current_query();
    echo $sf_current_query->get_field_string(“_sft_length”, array(“str” => “%2$s”));
    echo $sf_current_query->get_field_string(“_sft_rate”, array(“str” => “%2$s”));
    echo $sf_current_query->get_field_string(“_sft_guest”, array(“str” => “%2$s”));
    echo $sf_current_query->get_field_string(“_sft_location”, array(“str” => “%2$s”));
    echo $sf_current_query->get_field_string(“_sft_toy”, array(“str” => “%2$s”));
    ?>

    Trevor Moderator
    #43640

    Darn. We will have to revert to the code you had before and use PHP to trim the strings. I will need a clear run at this. Can I get back to you when I have an hour or so free (might be today, might be Sunday/Monday)?

    cascadegroup
    #43648

    Perfect, thanks for your help so far Trevor! 🙂

    Trevor Moderator
    #43840

    Hi

    Are you able to give me access to the page where the code currently is (is it in a template php file). This might mean having ftp access.

    cascadegroup
    #43906
    This reply has been marked as private.
    Trevor Moderator
    #43915

    Ok.

    So, this is the code I made:

    global $searchandfilter;
    $sf_current_query = $searchandfilter->get(339)->current_query()->get_array();
    foreach($sf_current_query as $key) {
      echo '<div>' . $key['active_terms'][0]['name'] . '</div>';
    }

    If you wanted to put the X before each, replace the echo line with something like this:

    echo '<div><a id="executeMyCodeLink" href="#">X</a> ' . $key['active_terms'][0]['value'] . '</div>';
    

    Where the code to add to the page would be something like this

    <script>
      $('#executeMyCodeLink').click(function(event) {
        /// Your code here
      });
    </script>

    But that is beyond the scope of what I can do easily 🙁

    cascadegroup
    #43920

    Just taken a look and works!!

    I will have a go at getting the “cross” to work.

    Thank you so much for your help Trevor.

    Trevor Moderator
    #43922

    Notice how I put some divs in there, so you can add a style class and style it how you want. I am sure that there will be a way to do the js.

    It would work like this, is my guess.

    Set the form element back to default value and then re-submit the form.

    Trevor Moderator
    #43923

    My guess is that Ross could knock something up in a jiffy to do that. I will ask him.

Viewing 10 posts - 11 through 20 (of 30 total)

The topic ‘How to style the search data’ is closed to new replies.