Dates filter on search don't work properly

Hello,

I’ve just found this issue. The search filter doesn’t work. At the beginning it looks like “search by dates” has a aleatory behaviour. But then, I found de cause.

This is the url when you do a search:

https://galiciadestinosostible.com/en/?post_type=hp_listing&_category=&s=&tipo_de_turismo=&provincia=&oferta_valida_hasta%5B%5D=2023-02-01&oferta_valida_hasta%5B%5D=2023-02-23

This value, oferta_valida_hasta (offer valid until) is the same in both sides of sentence.

Where we can set right this url?

You can try to search some listings on link bellow:

Thanks in advance!

Regards

Please edit this attribute in Listings/Attributes and make sure that it has the Date type for Editing and Date Range type for searching. Then the search should be ok, it’s normal that there are 2 occurrences of this attribute name in the URL - this way 2 dates are set in the URL since there’s no other way to include an array into plain text.

Hello,

All the Listing Attributes are exactly you say but still doesn’t work. I’ve attached an image where you can see the status of both Attributes (offer valid since and offer valid until).

I try to change some other attibutes but i don’t get that search works ok…

Regards

If it is two different attributes please try to set Date as a search field type for each of them. Then there are two search fields for these attributes where people will set the value for them separately

Hello,

If I set Date as a search field type for each them, the search only works if I select exactly the same end and finish dates.

For example, there’s a listing valid between 15/09/2022 to 15/10/2022. The filter only found this listing if I made a search with this exact date. But, if I search listings valid between 01/10/2022 to 15/10/2022 the filter doesn’t find any listing.

Regards

Sorry, there’s no simple code snippet - this requires advanced customizations.

If customizations are required for your site, please try customizing it using the collection of code snippets Search · user:hivepress · GitHub and other developer resources, or consider hiring someone for custom work https://fwd.cx/hLhc73mQCD9R

So, your solution is send me a list of no useful php code snippets on Github, great :confused:

Your site is looking very nice! Yes, I wish the search all listings via date range attribute would work. I do not understand why it would be there and not work. Right now there is no way for users to search date ranges of all listings. They can only see the calendar booking availability per listing, when booking.

I think yevhen is saying that their is no code snippet for it, and you have to find a developer to do it.

Sorry for the confusion. The functionality you described is possible, but only for a single Date attribute. For example, if you set the Date type in Edit context, and Date Range type in Search context for an attribute, then dates set for a listing should be searchable via a date range. If you mean taking 2+ date attributes into account when searching via a date range, this would require customizations.

Thanks for your feedback. This functionality is possible, but for a single date attribute in edit/search context. For example, if listings are concerts where each concert has a specific date, it’s possible to add such attribute and make it searchable by range, e.g. users will be able to search concerts for 5th-10th of October at once.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.