Index of dynamic categories

Okay, let me try to explain this as best as possible!

I am building a website to help couples find wedding photographers. Many couples want to find photographers who have experience at their specific hotel.

On my website, I want couples to browse photo galleries organized by hotel. For instance, one photo gallery would have 100 images from the Hyatt Hotel. Each image would be uploaded by a different photographer. So, couples could find their hotel, and browse images taken at that hotel from different photographers. (Remember the goal is to help couples discover photographers.)

I’ve created most of the database collections to build this. I’ve learned how to build a dynamic category page that only shows the photos from each venue presented in a gallery grid.

The database collection and the input form have these fields:
Photographer Name // Hotel Name // Image 1

HOWEVER… I can’t figure out how to create a dynamic index of the hotels. There will eventually be hundreds of hotels in the database, so I want the code to automatically sort them and present them to couples.

Example:

Couple visits the website and sees a list of all the hotels in the area from the database. When they click on the hotel name, they are directed to a photo gallery with all the images in the database taken at that hotel.

Dynamic list:

Hyatt
Marriott
Four Seasons
…and so on.

The page should pull the names of the hotel from the database… but the issue is there are many duplicates in the database. How can the index only show each hotel name ONCE?

Please help! Thanks!!

Hi,
It seems that the best way would be to model Hotel in a separate collection and be connected as a reference field. Please see here: CMS: About Reference Fields in Database Collections | Help Center | Wix.com

1 Like

Ohad, this was enormously helpful. I think I have the collections created properly now. I need some help to design the input form so it links the reference collection the right way.

On the input page, users would need to do these things:

– Type their name
– Add an image
– Select the name of the hotel from a drop-down menu

On my test site, it’s working fine when users populate the collection with their name and image. I also added a drop-down list that’s connected to the referenced collection (which contains the hotel data). However, when I click submit, the hotel name is not populating the collection. What do I need to do?

In other words, the new collection with photographer names and their images is not storing the hotel name associated with the new images/names.

I think I figured it out! Wahoo!

Now… the last piece…

I created a page with a repeater that lists all the hotels. I can’t figure out how to create a link, so when someone clicks on a hotel, they’ll be taken to a photo gallery containing all the images uploaded by photographers.

The repeater is pulling data from the hotel collection.

The images would come from the photos collection.