Skip Navigation

[Resuelto] Filter/search by post code

This support ticket is created hace 4 años, 8 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.

No supporters are available to work today on Toolset forum. Feel free to create tickets and we will handle it as soon as we are online. Thank you for your understanding.

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 3 respuestas, has 2 mensajes.

Last updated by Christian Cox hace 4 años, 8 meses.

Assisted by: Christian Cox.

Autor
Mensajes
#1296785

SD
order online for delivery & takeaway 2019-07-20 15-22-34.jpg

Hi there, i'm trying to create a directory with restaurants where the user

1) should be able to filter by post code in order to see what restaurants will deliver to his area/post code.

2) search results should be divided in two sections, the restaurants that deliver to his/her post code and are currently open and the restaurants that deliver but are currently closed or available only for takeout at the moment.

Number 1 is definitely my priority for the moment. Can you please advice what is the best way to achieve this using toolset?

Thanks,
Stelios

#1297009

Hello, one way to accomplish this is to use a multiple-instance single-line custom field.
- Create a single-line custom field "Postal Codes" and choose the option "Allow multiple-instances of this field". Apply this field to the restaurant post type.
- When you create or edit a Restaurant post, add all the postal codes they serve in the postal codes field.
- In a custom search View, you can filter by postal code using a text field.

Let me know if you have questions about this approach, or if I misunderstood what you want to achieve.

#1297015

SD

Hi Christian,

thank you so much for the reply.

How about this one ? Any ideas?

"Search results should be divided in two sections, the restaurants that deliver to his/her post code and are currently open and the restaurants that deliver but are currently closed or available only for takeout at the moment."

#1297039

This isn't as straightforward. Toolset doesn't have a built-in timeline availability feature like this, unfortunately, and it sounds fairly complex since you would need to be able to manage the start and end times for multiple schedules (takeout, delivery, dine-in) for each restaurant on each day of the week.

Once you have determined how you want to handle that information management, you would have to programmatically modify the query for each search based on the current day and time. We offer the wpv_filter_query API to help you programmatically modify queries like this:
https://toolset.com/documentation/programmer-reference/views-filters/#wpv_filter_query

You could use two Views to display this information in different sections. The first View could contain the filters and the results (delivery available results), and the second View could contain just the results (delivery not available results). In this case, AJAX would not be supported.

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