Skip Navigation

[Resolved] Ajax Filter Controllers With RANGE

This thread is resolved. Here is a description of the problem and solution.

Problem: I have a custom search View that lists posts. I would like to filter these posts by 3 custom fields. One of the custom fields should be filtered as a range, with a min and max value.

Solution: When adding the Search Filters in your View, choose the option to compare "between", and always compare numbers as type "UNSIGNED".

Relevant Documentation:
https://toolset.com/documentation/user-guides/filtering-views-by-custom-fields/

This support ticket is created 6 years, 1 month ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 - -
13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 - -

Supporter timezone: America/New_York (GMT-04:00)

This topic contains 12 replies, has 2 voices.

Last updated by theW 6 years, 1 month ago.

Assisted by: Christian Cox.

Author
Posts
#1127067

Hello Toolset,
Your awesome plugins have really made my life easier!
I decided to renew my license : )

Tell us what you are trying to do?

THIS IS WHAT I ALREADY DID:

* I created a Custom Post, with Toolset Types
* I created 3 Custom Fields,
- State
- Price
- Down Payment

* I created a MAP View of these Custom Posts
hidden link

THIS IS WHAT I NEED HELP WITH:

* Set up the Filter Controllers for the Map View
* In the right hand Side, (like the example)
* With those 3 Custom Fields BUT...

* The "Price" Controller, should pull everything from the amount entered DOWN.
* The "Down Payment" Controllers, should pull everything in BETWEEN the Min and Max.
* The "State" Field, is the easiest no variation there, simply pulling what State is selected.

Is there any documentation that you are following?

https://toolset.com/documentation/user-guides/filtering-views-by-custom-fields/

Is there a similar example that we can see?
OLD BAD SITE:
hidden link
Using:
- Maps Builder Pro (bad)
- Easy Property Listings (bad)
(It functions but I'd like to use the Toolset)

What is the link to your site?

NEW GOOD SITE:
hidden link
Using:
* Toolset Views / Toolset Maps (good)
* Toolset Types (good)

Please advice, I would appreciate your help a lot!
The sites are private, please let me give you the access privately.

#1127078

Hi, I will activate private reply fields here.

#1127098
Screen Shot 2018-10-14 at 2.55.11 PM.png

Okay I see that you are using this View to generate the map:
hidden link

The next step is you need to set up custom search filters for this View. For now, we will show the filters and the map together. I will show you how to separate them later.

Edit the View and scroll down to Search and Pagination options. Place your cursor inside the [wpv-filter-controls][/wpv-filter-controls] tags. Then click "New Filter" and select "State" to insert a filter for the state. The default options should be fine.

Then click "New Filter" again and select "Down Payment" to insert a filter for the down payment field. In the next screen, you will be able to choose "Using this comparison". See the screenshot. Choose "between", then insert the shortcode.

Finally click "New Filter" again, and select the "Price" field. In the next screen for "Using this comparison" choose "Lower than or equal to".

Let me know if you are able to get this far or if you get stuck on one of these steps.

#1127134

Thank you very much Christian!

Looks like I was able to follow your instructions and now the Filter Controllers are showing!
I was also able to place them in the right hand side using the Grid button in the Output Editor.

hidden link

Only a couple challenges remain..

Ideally, on the "Price" controller, there should be two fields: a "Minimum Price" and a "Maximum Price"
From the values of these we will get the "Between" range.

Also, the filter should Kick in as soon as the user inputs the values in the fields.
Do you recommend I make these controllers all drop-downs with amounts to select from?

How can I do that but at the same time, allow users to put any amount in this fields to the penny when creating new Custom Posts?

#1127150

Ideally, on the "Price" controller, there should be two fields: a "Minimum Price" and a "Maximum Price"
When you select the "between" comparison in your custom search Filter, two input fields will be shown automatically. If that is not happening, please copy + paste the filter shortcode here for me to review, and also take a screenshot of the Query Filter for this field. I will review those settings.

Also, the filter should Kick in as soon as the user inputs the values in the fields.
In the Custom Search settings panel of the View editor, you can choose different options. You should choose "AJAX results update when visitors change any filter values". If you cannot find the Custom Search settings in your View editor, scroll up to the top of the page and open the "Screen Options" tab. You can enable the Custom Search settings there. If you have additional questions about this please create a separate ticket.

Do you recommend I make these controllers all drop-downs with amounts to select from?
I think they are fine as they are now. The Down Payment field could work either as a select or a text input. With a select, the User doesn't have as much flexibility to choose custom values. With a text input, that value is completely custom.

How can I do that but at the same time, allow users to put any amount in this fields to the penny when creating new Custom Posts?
The custom field should be a "number" field. However when you insert the custom search filter you can choose from different input control types. You can choose "select" here, even if the field is a number field. If you need more information about that please create a separate ticket so we can continue discussion.

#1127165
AJAX.png

Thanks again Christian,
I corrected the "Minimum Price" and "Maximum Price" Filters.
I had also set the AJAX settings previously but the filter doesn't seem to trigger when typing on the text boxes.
Please advice:
hidden link

#1127174

You can enter a value and press "return", or enter a value and tab out of the field to trigger an update. The automatic update does not occur as you type numbers.

#1127175
T.png

I see, thank you Christian that helps.

For some reason if I input 2 - 4 and hit the enter key, the filter is not that accurate.

Please see screen shot attached. Did I did something wrong?

#1127487

It might be easiest if I log in to your wp-admin to see how this is set up. Is that possible? If so, please provide login credentials in the private reply fields here. If not, please edit this View, expand all the Query Filters, and take screenshots so I can see how these filters are set up.

#1127555
Screen Shot 2018-10-15 at 11.57.15 AM.png

Okay I checked the Query Filter and it looks like it was configured to filter Price as a "string". See the attached screenshot. This option should be changed to "UNSIGNED" for the best results when comparing numbers.

#1127570

Thank you very much Christian!
Should I also changed the Downpayment to "UNSIGNED" since it's also a numeric field?

#1127658

Yes, I believe that would be a good idea.

#1127660

My issue is resolved now. Thank you!