We are transitioning over to a new forum platform. Please post new issues there. Existing threads will be dealt with here unless you choose to move them over. Visit the new forum

Forum

Thread tagged as: Question, Events

Filtering events by zip code?

Hi,

I have a potential upcoming project that'll need to allow visitors to enter their zip code and see all the upcoming events occurring in their area. The total number of events for all zip codes will probably be in the hundreds. If the zip code is one of the fields when entering an event in Perch, is it possible for a visitor to input their ZIP code and then see only the events in their area? If so, are there any examples of this kind of filtering available?

Thanks!

Franz Neumann

Franz Neumann 0 points

  • 4 years ago
Drew McLellan

Drew McLellan 2637 points
Perch Support

Are you talking about needing some sort of geographical search, or simply comparing one zip code to another?

At this point, just displaying events that match the same zip code, though ideally a search of nearby zip codes is ideal.

Drew McLellan

Drew McLellan 2637 points
Perch Support

So you should be able to do that with a basic filter

'filter' => 'zipcode', 
'match' => 'eq' , 
'value' => '1234',

Thanks. I guess where I'm tripped up on is how to get the user-entered ZIP code into the filter. Would I use the same techniques here?:

http://solutions.grabaperch.com/architecture/user-filtered-lists

I'm not sure if perch_event_custom works the same way as the examples in the docs above for perch_content_custom user-filterable lists.

Thanks!

Drew McLellan

Drew McLellan 2637 points
Perch Support

Yes, same technique, or if they have accounts, from the member data.