- This topic has 2 replies, 2 voices, and was last updated 6 years, 7 months ago by .
Viewing 3 posts - 1 through 3 (of 3 total)
Viewing 3 posts - 1 through 3 (of 3 total)
These forums are now closed and remain for historical purposes.
None of the content applies to the new version 3. For support, get in touch via our contact form.
Forums › Forums › Search & Filter Pro › i want to get the current active filter sort label
Tagged: label
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…
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>';
?>