Forums Forums Search & Filter Pro i want to get the current active filter sort label

Tagged: 

Viewing 3 posts - 1 through 3 (of 3 total)
  • Anonymous
    #213325

    I want to get the currently active filter sort label

    I try this

    global $searchandfilter;
    $sf_current_query = $searchandfilter->get(1391)->current_query();
    
    $array_data = $sf_current_query->get_array();
    $typeOfSearch = $array_data["_sf_sort_order"]["active_terms"][0]["value"];

    but I can’t get the label…

    Trevor
    #213328

    You can find more details from the filter query array.

    You may need to temporarily output the array to see how to access the term that you want.

    If you add this code to the page, it will output the entire array:

    <?php
    global $searchandfilter;
    $sf_current_query = $searchandfilter->get(1391)->current_query()->get_array();
    echo '<pre>',print_r($sf_current_query,true),'</pre>';
    ?>
    Anonymous
    #213332

    thank you very much!

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