Skip Navigation

[Resolved] Filter products by years between to values of select boxes.

The Toolset Community Forum is closed, for technical support questions, please head on to our Toolset Professional Support (for paid clients), with any pre-sale or admin question please contact us here.
This support ticket is created 7 years, 2 months ago. There's a good chance that you are reading advice that it now obsolete.
This is the community support forum for Types plugin, which is part of Toolset. Toolset is a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients and people who registered for Types community support can post in it.

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

Supporter timezone: America/Jamaica (GMT-05:00)

This topic contains 12 replies, has 2 voices.

Last updated by Shane 7 years, 1 month ago.

Assisted by: Shane.

Author
Posts
#573290
function-php.PNG
125.PNG
124.PNG
123.PNG

Tell us what you are trying to do?
Give users the ability to filter products between to selected years (eg. from 1999 to 2016).

Is there a similar example that we can see?
I need to do the same like here, from certain year to another..
hidden link

What is the link to your site?
hidden link

I have tried to fill the years in each select box (from/to) by jQuery but it didn't work.

#573424

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Jorn,

Thank you for contacting our support forum.

Is there a field on the post themselves that has these year fields that you are filtering for ?

Please let me know.
Thanks,
Shane

#573989
post-field-body.png
post-field.PNG

Hello Shane,

Yes, it called 'Model Year' please see attached photos..

Thanks

#574673

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Jorn,

I see that everything is actually setup correctly.

Would you mind providing me with admin access so that I can have a more detailed look at this for you ?

The private fields will be enabled for your next response.

Thanks,
Shane

#575273

Hi Shane,

The private fields are not enabled!?

Thanks

#575359

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Jorn,

Sorry about that the fields have been enabled now.

Thanks,
Shane

#575447

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Jorn,

Thanks for the credentials.

Im currently having a look.

#575865

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Jorn,

What did you use to populate the model year as I see that it was not added through the Types settings.

Thanks,
Shane

#576397

Hi Shane,

If there is anyway to do that through the Types settings, please let me know, I've spend so much time on searching, and the only solution I found is to do it dynamically through PHP (wpt_field_options).

Thanks

#576939

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Jorn,

The issue with this is that since the field was not populated through types then there isn't any record of it in the database to compare to whats on the CPT.

The only other option is to manually add the values to the filters to compare to .

Thanks,
Shane

#577210

Hi Shane,

Then I'm gonna need a function to add the new year every year! is that possible?

Thanks.

#577817

Any update 🙂

#577944

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Jorn,

I must apologize for the delay in response.

Unfortunately I'm not able to assist with the custom code for this, however instead of using select fields why not use a single line field and allow the user to enter the year value in an example format that you will set.

This will allow you to use a select value on the frontend to perform the search without having the manually populate all the dates yourself.

Thanks,
Shane

The forum ‘Types Community Support’ is closed to new topics and replies.