Create a simple booking page

Rating

Any association or institution organizing an activity wants a registration form. Usually there is a limited number of participants.

How do you create a form that tracks how many people have already been registered and how you make it impossible to book once the maximum number of participants has been reached? There are modules for that, but they are quite heavy and complex.

Method:

1) Create a content type with the options. For example ... We have a training up to five people. People can choose between two dates, but each time we have only five places. You see I repeat the node a certain number of times per date. You could also provide here a numbered place. If many nodes need to be created, I refer to Feeds and a CSV file to do this. In now take node reference, but taxonomy reference is also possible.

Screen001558.png

2) Create a content type 'Booking' with a reference field to your content type with the options. Put multiple if necessary. For example, one person books for several people in his / her name.

Screen001573.png

Now one can book.

Screen001574.png

I have booked in my name for three people on 27/10

Screen001563.png

3) How do you create that the next person is unable to use already taken places? A new booking should only see this. Three places have already been taken.

Screen001569.png

We therefore make a view, where we show the places and the bookings for these places.

Screen001566.png

There is a relationship necessary to do so as we combine two content types.

Screen001564.png

Set the 2 fields

Screen001575.png

The Title field is X 2. The second time, however, with the relationship:

Screen001565.png

You get this.

Screen001566.png

However, since we want only the free places we now have to filter.


Screen001567.png

You will see that there are some places are missing. Where there is already booked for ...


Screen001576.png

4) Set a reference entity to use your reference field.

Copy your view to entity reference.

Screen001560.png

Customize your field in the widget to your reference. 

Screen001562.png
From now on your booking page is operative. Now only grant access rights to the form. If all the places are occupied you only get the description of the field.

Screen001577.png