Forums Forums Search Search Results for 'active_terms 0 name'

Viewing 5 results - 41 through 45 (of 45 total)
  • Author
    Search Results
  • #43915

    Trevor
    Participant

    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 🙁

    #43565

    Anonymous
    Inactive

    Hi,

    I’ve added the code but it seems to be throwing an error on the array. Am I missing something?
    <?php
    //Get a multiple fields values by passing an array of field names
    //replace 1526 with the ID of your search form
    global $searchandfilter;
    $sf_current_query = $searchandfilter->get(339)->current_query();
    echo $sf_current_query->get_fields_html(array(), array(‘show_all_if_empty’ => false)
    );
    ?>

    I’ve also added the code from the supplied link but it throws back the following error:
    array(2) { [“_sft_length”]=> array(5) { [“name”]=> string(13) “Yacht Lengths” [“singular_name”]=> string(12) “Yacht Length” [“all_items_label”]=> string(17) “All Yacht Lengths” [“type”]=> string(8) “taxonomy” [“active_terms”]=> array(1) { [0]=> array(4) { [“id”]=> int(6) [“name”]=> string(6) “40-50m” [“value”]=> string(6) “40-50m” [“count”]=> int(5) } } } [“_sft_toy”]=> array(5) { [“name”]=> string(15) “Yacht Hero Toys” [“singular_name”]=> string(14) “Yacht Hero Toy” [“all_items_label”]=> string(19) “All Yacht Hero Toys” [“type”]=> string(8) “taxonomy” [“active_terms”]=> array(1) { [0]=> array(4) { [“id”]=> int(16) [“name”]=> string(7) “Freezer” [“value”]=> string(7) “freezer” [“count”]=> int(5) } } } }

    Found on the same web link as before.

    #39703

    Anonymous
    Inactive

    I finally found this solution:

    $sarr = $sf_current_query->get_array();

    $author = $sarr[authors][active_terms][0][name] ;
    $fromDate = $sarr[_sf_post_date][active_terms][0][value] ;
    $toDate = $sarr[_sf_post_date][active_terms][1][value];

    I hope it keeps on working always!

    #39701

    Anonymous
    Inactive

    Hi!
    Sorry for my late reply but I had to complete another project..
    If I do a var_dump I get the following:
    array(2) { [“authors”]=> array(5) { [“name”]=> string(7) “Authors” [“singular_name”]=> string(6) “Author” [“all_items_label”]=> string(11) “All Authors” [“type”]=> string(9) “post_type” [“active_terms”]=> array(1) { [0]=> array(3) { [“id”]=> int(39) [“name”]=> string(7) “Agenzie” [“value”]=> string(7) “agenzie” } } } [“_sf_post_date”]=> array(1) { [“active_terms”]=> array(2) { [0]=> array(1) { [“value”]=> string(8) “01032016” } [1]=> array(1) { [“value”]=> string(8) “16032016” } } } }

    In my form I have Authors (in this example value for that is “Agenzie”) and Post Date range fields.
    I am not expert in PHP…can you help me to get the authors and post date range?
    As $sf_current_query->get_field_string(“authors”) does not work.

    Thanks

    #31943

    Anonymous
    Inactive
    
    array(5) { 
    
    ["_sft_credit_card_category"]=> array(5) { 
    	["name"]=> string(22) "Credit Card Categories" 
    	["singular_name"]=> string(20) "Credit Card Category" 
    	["all_items_label"]=> string(26) "All Credit Card Categories" 
    	["type"]=> string(8) "taxonomy" 
    	["active_terms"]=> array(1) {
    		[0]=> array(3) { 
    			["id"]=> int(20) 
    			["name"]=> string(16) "Balance Transfer" 
    			["value"]=> string(16) "balance-transfer" 
    			} 
    		} 
    	} 
    
    ["_sfm_issuer"]=> array(5) { 
    	["name"]=> string(0) "" 
    	["singular_name"]=> string(0) "" 
    	["all_items_label"]=> string(0) "" 
    	["type"]=> string(9) "post_meta" 
    	["active_terms"]=> array(1) { 
    		[0]=> array(2) { 
    			["name"]=> string(15) "Bank of America" 
    			["value"]=> string(15) "Bank of America" } 
    		} 
    } 
    
    ["_sfm_credit_quality"]=> array(5) { 
    	["name"]=> string(0) "" 
    	["singular_name"]=> string(0) "" 
    	["all_items_label"]=> string(0) "" 
    	["type"]=> string(9) "post_meta" 
    	["active_terms"]=> array(0) { } 
    
    } 
    
    ["_sf_post_date"]=> array(2) { [0]=> string(0) "" [1]=> string(0) "" } 
    
    ["_sf_sort_order"]=> array(0) { } 
    
    } 
    
Viewing 5 results - 41 through 45 (of 45 total)