To create a store locator page in Webflow with the functionality you described, you can follow these steps:
- Design your Store Locator page: Start by designing and creating the layout for your store locator page in Webflow. Use the CMS collection to store data about each store, including its name, address, latitude, and longitude.
- Create a Webflow form: Add a form element to your page to allow users to input their postal code. You can style this form to match the design of your site.
- Set up the Zapier integration: Use Zapier to connect your Webflow form to your XML feed. Create a new Zap in Zapier, and set the trigger as the Webflow form submission. Then, configure the action step to retrieve the data from your XML feed using the postal code submitted in the form.
- Display stores on the map: Use a map element in Webflow to display the stores on the map. You can use Google Maps or a similar map service. To do this, use custom code to fetch the latitude and longitude of the nearest store from the XML feed and pass it to the map element. You can include JavaScript code in the Webflow project settings or use an HTML embed element on your page to add the map.
- Populate the store listing: To display the list of nearest stores beneath the map, you can create a dynamic list using the CMS collection of stores. Filter the stores based on their proximity to the postal code submitted by the user. You can use custom code to calculate the distance between two coordinates (the postal code and the store's coordinates) and only display the stores within a certain radius.
- Style and customize the listings: Use Webflow's CMS and collection list features to display the store information in a listing format. Customize the design of the listing to match your website's style.
- Test and iterate: Test the store locator page by submitting different postal codes and verifying that the correct store is displayed on the map and in the listing. Make any necessary adjustments to the filtering logic or design to improve the user experience.
By following these steps, you can create a store locator page in Webflow that allows users to input a postal code, retrieves data from an XML feed using Zapier, populates the nearest store on a map, and displays a listing of the stores.