Skip Navigation

[Cerrado] Problem with date front-end filters

This support ticket is created hace 10 años, 2 meses. 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
- 10:00 – 19:00 10:00 – 19:00 10:00 – 19:00 10:00 – 19:00 10:00 – 19:00 -
- - - - - - -

Supporter timezone: Europe/Madrid (GMT+01:00)

This topic contains 3 respuestas, has 2 mensajes.

Last updated by Caridad hace 10 años, 2 meses.

Assigned support staff: Caridad.

Autor
Mensajes
#20663

Hi,

I have implemented a front-end filter of events - see the right hand side of this page:

hidden link

The problem is that the start date IS working but the end date ISN'T - results are returned with a date greater than than the end date.

The filters are (key bit in bold):

Select posts with custom fields: wpcf-eventdate <b>BETWEEN URL_PARAM(startdatedate),URL_PARAM(enddatedate)</b> OR wpcf-eventgroup = URL_PARAM(group) OR wpcf-eventtype = URL_PARAM(type) OR wpcf-eventheme = URL_PARAM(theme)

Both the start and end date params are looking at the same Types date field.

I have set the BETWEEN operation as NUMERIC, as DATE doesn't seem to work.

The Meta HTML for the front-end filters is:

[wpv-filter-start hide="true"]
[wpv-filter-controls]
<div id="filtercontrols">
<p class="filterlabel">LOCATION</p><p>[wpv-control field="eventgroup" url_param="group"]</p>
<p class="filterlabel">THEME</p><p>[wpv-control field="eventheme" url_param="theme"]</p>
<p class="filterlabel">EVENT TYPE</p><p>[wpv-control field="eventtype" url_param="type"]</p>

<p class="filterlabel">FROM [wpv-control field="eventdate" type="datepicker" date_format="" url_param="startdatedate"]</p>
<p class="filterlabel">TO [wpv-control field="eventdate" type="datepicker" date_format="" url_param="enddatedate"]</p>

<p>[wpv-filter-submit name="SEARCH EVENTS"]</p>

</div>
[/wpv-filter-controls]
[wpv-pagination]
<p>[wpml-string context="wpv-views"]Showing page [wpv-pager-current-page] of [wpv-pager-num-page][/wpml-string] [wpv-pager-prev-page][wpml-string context="wpv-views"]Previous[/wpml-string][/wpv-pager-prev-page] [wpv-pager-next-page][wpml-string context="wpv-views"]Next[/wpml-string][/wpv-pager-next-page]</p>
[/wpv-pagination]
[wpv-filter-end]

Am I doing something wrong or is this a bug?

Thanks, Simon

#20779

Dear Simon,

Because you have OR between your conditions, records that match any of the other conditions will be displayed. Even if the date is outside of the range. Try using AND and you will only get those emtries between the dates.

Please let me know if there is anything else that I can assist you with.

Regards,
Caridad

#21133

It still seems odd to me that it's observing the start date but not the end date. If it's because it's an OR search, surely it would return ALL results, not just those after the start date...?

#21356

Dear Simon,

Just for testing, disable the other controls temporarily and leave just the date controls. Let see if it makes sense that way, this should show you only records between those dates.

Please let me know if there is anything else that I can assist you with.

Regards,
Caridad

El debate ‘[Cerrado] Problem with date front-end filters’ está cerrado y no admite más respuestas.