Skip Navigation

[Resolved] filter search by price range and date range

This support ticket is created 8 years 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.

Our next available supporter will start replying to tickets in about 1.46 hours from now. Thank you for your understanding.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Hong_Kong (GMT+08:00)

This topic contains 5 replies, has 3 voices.

Last updated by houssamS 8 years ago.

Assisted by: Luo Yang.

Author
Posts
#385827
pricerange.png

I noticed this topic already mentioned in 2012 but I think now you have another easier method to implement.

I am trying to: Implement a filter based on price range like (0 to 100,000) and (100,001 to 200,000) and (above 200,001) and a date range like (less than one year) and (more than one year) where it will calculate based on current date. For example if I set property availability date as Feb 2017, it will consider it less than one year counting on today's date.

#386085

Dear houssam,

There isn't another easier method to implement your request yet, in your case I suggest you try with Views filter hook "wpv_filter_query" to apply the custom filters,
wpv_filter_query
https://toolset.com/documentation/user-guides/views-filters/wpv_filter_query/
Date Filters
https://toolset.com/documentation/user-guides/date-filters/

#386299
datefilter.png

Dear Luo,
I am feeling challenged. I bought Toolset thinking that I wouldn't need to write any code. I am afraid I will need to ask for a refund.

Anyway before I reach that point I want to still spend a bit of time to try to make it work.

For the price range, if you can please send me a step by step guide as to how to make it. Where should I put the function? in my functions.php or inside Toolset? what arguments should I pass and how? I believe there should be a detailed guide for this.

for the date range, I couldn't also do it. I am trying to add a filter in the View search using a date custom field. but the options I am getting are different form the ones mentioned in the link you sent

#387285

You are right, I do think it is a good feature, so I put it into our to-do list as a feature request, our developers will take care of it. but there isn't any ETA for it.

In your case, it needs some custom codes to implete such kind of filters, according to our new Toolset Support Policy:
https://toolset.com/toolset-support-policy/
Getting help with custom coding
Some projects simply require custom coding beyond the out-of-the-box features and functionality of Toolset. Please note that we can not do this work for you. Again, we can point you in the right direction (our documentation, for example) but you will either need to learn how to do this by yourself or hire a third-party developer.

When you need custom development, please refer to the list of our certified Toolset Consultants. These are all great developers, speak different languages (all speak English too) and are a pleasure to work with.

So I can provide you the document links:
wpv_filter_query
https://toolset.com/documentation/user-guides/views-filters/wpv_filter_query/

And here is the our certified partners:
https://toolset.com/consultant/

#387788

Juan
Supporter

Timezone: Europe/Madrid (GMT+02:00)

Hi Houssam

This is Juan, lead Toolset developer, and the one in charge of Views.

First of all, let me apologize for the delay with this feature, and if we have caused you any issue.

I know this has been discussed a number of times, and in the past we already mentioned that we would evaluate and eventually bring this feature to Views, but the reality is that it is not that simple. Let me elaborate.

While the feature seems easy to grasp (use a set of frontend controls as checkboxes, each of them pointing to a range of values for a given custom field), and coding the solution does not seem to be entirely complex (because we have all the means to do so, like filtering by values BETWEEN a minimum and a maximum), the harder part here is providing a good GUI and shortcode options to cover this behavior.

Overall, for this feature we need to:
* Find a way to set minimin, maximum values, as well as the option label. Each option must have at least those three elements.
* Code how this will be rendered in the frontend, including all the different frontend controls (checkboxes, radios, select dropdowns, etc), which demands also a carefull review of data attributes on each control.
* Decide how this will be managed in the frontend, too. We need to post the form with two values for each selected option, plus the placeholder one that actually sets it as selected when the form returns content. This can be done fast (with hidden inputs that will populate your form) or with JavaScript, or making things more complex by storing data as part of the View settings (which involves invalidation, for example, when removing the filter).
* Besides that, we also need to check how this plays with existing parametric search features, like AJAXed results, and combinations with other Views features, like AJAX pagination and table sorting.

As you can see, it is quite a complex task in the end. Ww know this would be a quite usefull way of presenting parametric searc filters to visitors, but we have had other most needed tasks to work on, including security improvements, long-waiting features demanded by lots of users and several (several) bug fixes.

I can put this into the list of tasks that we will evaluate on the coming Views versions, but I can not guarantee that this will come to happen anytime soon.

Again, sorry about the late response and the bad news. I can bring you some good news.

You can indeed search for a range of values, although you need different controls for the minimum and maximum values You can have this with select dropdowns, although not with checkboxes. In the end, there are basic options to provide the search capabilities that you want to have, just not the exact way you want to have them.

Hope it helps.

Regards.

#388336

Thanks for the support.

This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.