Forums Forums Search & Filter Pro Query another WordPress table

Viewing 9 posts - 31 through 39 (of 39 total)
  • Anonymous
    #51073
    This reply has been marked as private.
    Trevor
    #51075

    No, we had to bump the meeting to first thing tomorrow 🙁

    Trevor
    #51144

    What happens if you uncomment this line:

    //return $query_args;

    Like this:

    return $query_args;

    You have to return the object that had been passed in.

    Anonymous
    #51158

    Hi Trevor,
    Thank you for your e-mail. That line is uncommented on the live version.

    If you check the php files that I’ve sent you you’ll see that that line is uncommented. What you have in the 2 php files is what is live right now as I didn’t update these files since I’ve sent them to you.

    Thank you for your help,
    François

    Trevor
    #51160

    OK, I have forwarded these to Ross, as I can’t see the error or where it needs changing 🙁

    Anonymous
    #51408

    Hello Trevor,

    I hope you are doing well!

    I really want to go on our project this week and it would be great if Ross could have a look at my request soon :-).

    Thank you,
    Have a nice day!

    François

    Anonymous
    #51869

    Just my two cents:

    To me it looks like the query_args never get updated with the selected options (checkboxes, dropdowns) from the search form. Only options set in the S&F UI like in the “Post Meta” tab and the “Posts” tab like order, post_type are added.

    These “fixed” query_args are then passed to WP_Query. The result id’s are filtered based on the GET/url filters. I might be wrong, but this is what I get from looking over the S&F code. This means you will not be able to remove your added datepicker from the query_args.

    I am in the same boat, hence my interest in this topic.

    What I did was the as follows:
    Remove the datepicker (change “animals” to your datepicker metafield name. from the get request, this can be done in a custom plugin on the init action. In my case I have a checkbox for post_meta fields which I unset with:

    if(isset($_GET['_sfm_animals'])) {
                $_GET['my_sfm_animals'] = $_GET['_sfm_animals'];
                unset($_GET['_sfm_animals']);
            }

    As you can see, I keep a reference to the field with the “my” prefix. You will need this later in order to keep the checkbox selected, or with the datepicker to have the date still set when returning results.

    Now comes the ugly part. You will have to edit the plugin file
    “class-search-filter-active-query.php” and add a similar entry just before:
    “$this->field_values = $field_values;”

    
    if($_GET["my_sfm_animals"]) {
    			$keys = explode("-+-", $_GET["my_sfm_animals"]);
    			if(count($keys)) {
    				foreach($keys as $value) {
    					$field_values['_sfm_animals'][]  = $value;
    				}
    			}
    		}
    

    Without this edit, my selected checkboxes are unchecked after returning the results (might not be necessary on ajax requests).

    I hope this is of any help to you, for me this works great. I can now exclude all selected animals from the results, based on what the user selected.

    Ross Moderator
    #53701

    Hey Arend

    Thanks for your workaround you posted (haven’t tested it yet).

    François, did that help you or still stuck?

    As mentioned a few posts back, rather than figuring out an elaborate hack like this (!) I’m actually hoping to support these features to make this possible (including creating your own field)…

    I’m happy to take a look at what you are doing and advise but you’re entering uncharted territory 😉 I think the real solution is just to implement this as proper features!

    Best

    Anonymous
    #53938

    Hi Arend and Ross,

    Thank you for your feedback. I didn’t give it a try yet.
    I’ll probably try this this weekend.

    François

Viewing 9 posts - 31 through 39 (of 39 total)