top of page

Min Max Price Filter for Wix Data Repeater

Min Max Price Filter for Wix Data Repeater

The Wix Wiz

Nov 20, 2023

9

Tags:

Database, Database filter, Sort

Hey there, and welcome back to the Wix Wiz. In this video, we're diving into a comprehensive tutorial on creating a Min Max Price Filter for Wix Data Repeater using Velo Code.


If you've been wanting to add advanced filters to your Wix website, especially for displaying data from a collection, you're in the right place. We're tackling a viewer-suggested topic straight from the Suggest and Vote section on the Wix Wiz YouTube page. Today's focus is on Advanced Filters, specifically demonstrating how to implement a price filter for a repeater displaying data from a collection.


The goal is to allow users to input a minimum and maximum price, dynamically filtering the displayed data accordingly. In this tutorial, we're covering two methods: one using input fields and the other utilizing a price range slider for a more visual experience. I've already set up a basic repeater and a car listing directory with a collection named "cars" in the CMS. The collection includes various data points, with the essential one being the "price" field, crucial for our filtering.


Keep in mind, that this approach can be adapted for other numeric fields beyond just prices. To establish the connection between the collection and the repeater, we utilize the Wix Data API. Through asynchronous functions like "populateCarsRepeater" and "setUpCarsRepeater," we fetch and display the data in the repeater. The magic happens by querying the "cars" collection and assigning the results to the repeater's data property.


The Min Max Price Filter function is where the real action begins. For input-based filtering, we capture user input for minimum and maximum prices. The Wix Data API ensures that our queries fetch only the relevant data. We've also added a safeguard to prevent users from setting unrealistic filter ranges. But that's not all – we take it up a notch with a price range slider.


By tapping into the slider's properties, we dynamically adjust the min and max values for a seamless filtering experience. As a bonus, we even update the input fields to reflect the chosen range visually. Remember, coding is an iterative process. Debugging and refining your code are part of the journey, so don't be discouraged if you encounter hiccups. If you're interested in diving deeper into Velo and JavaScript, check out my Velo for Beginners course on Udemy.


If you found this tutorial helpful, don't forget to like, comment with any questions or thoughts, and subscribe for more Wix-related content. Your feedback is valuable, and I look forward to seeing you in the next video. Happy coding!



Related videos

Wix ideas.jpg
Sumo Digital
Nov 7, 2022

152

Adding multiple filters to a collection

Wix ideas.jpg
The Wix Wiz
Jun 10, 2024

18

How to Speed up Data Queries in Wix with Indexes

Wix ideas.jpg
Codex Community
Apr 22, 2024

34

Top 2024 Web Design Trends

bottom of page