Forums › Forums › Search & Filter Pro › Accessing Field slug on search results
- This topic has 4 replies, 2 voices, and was last updated 7 years, 5 months ago by
Trevor.
Viewing 4 posts - 1 through 4 (of 4 total)
-
Anonymous(Private) March 30, 2018 at 1:42 pm #169183
Thank you Trevor – this outputs:
Array ( [_sft_product_cat] => Array ( [name] => Product categories [singular_name] => Category [all_items_label] => All categories [type] => taxonomy [active_terms] => Array ( [0] => Array ( [id] => 128 [name] => Men's Shoes [value] => mens-shoes [count] => 0 ) ) ) [_sft_pwb-brand] => Array ( [name] => Brands [singular_name] => Brand [all_items_label] => All Brands [type] => taxonomy [active_terms] => Array ( [0] => Array ( [id] => 220 [name] => Ted Baker [value] => ted-baker [count] => 0 ) ) ) )
And the bit I need is the “value” of “_sft_pwb-brand” – i.e. “ted-baker”
Thanks in advance 🙂
Anonymous(Private) March 30, 2018 at 1:56 pm #169189I think I’ve sorted it thanks Trevor – sorry to mess you around!
If anyone else needs it, the code is as follows:
<?php global $searchandfilter; $sf_current_query = $searchandfilter->get(1446)->current_query(); $array_data = $sf_current_query->get_array(); $typeOfSearch = $array_data["_sft_pwb-brand"]["active_terms"][0]["value"]; echo $typeOfSearch ; ?>
Where _sft_pwb-brand is the field you need, and 1446 is the ID of the search form.
-
AuthorPosts
Viewing 4 posts - 1 through 4 (of 4 total)