Proposals for a commerce booking system

Here are my thought about a new booking system integrating commerce in Drupal.

1. Create a new entity called Bookable Units

Bookable units are fieldable entities, as those proposed by the Rooms module but without hardcoded fields (like sleeps, etc...).
Ex: seats, cars, or any rentals products.

2. Create to availability calendar fields

I love the availability calendar module, with a few improvements (http://drupal.org/node/1800894) we would be able to do this:
Two availability calendar field for each bookable unit:

  • one called "Stock calendar" which permit to define stocks on a calendar basis,
  • one called "State calendar" for front view to display availability state.

Ex: there is 12 cars availables between 12/03/2013 and 12/04/2013, but only "Available" is showing for front users.
That allow for example to define stocks on 0 (unavailable) for holidays or on week ends.

3. Create a product and attach a bookable unit with an entity reference field

Several product can share same bookable unit
Ex: 2 difference travel tours with guides on same days, guides can be attached to both tours, if all guides are booked for one tour, there is no left guides for the other tour.

4. Create a date field on product line items: field_booking_date

A simple date field for add to cart form

5. Create a pre-calculated field on product line items: field_line_item_availability

A field returning stocks for product attached bookable unit, calculated from field_booking_date value and the bookable unit attached to product.

6. Create a general Rules event looping between each line items in a cart

Theses Rules are almost the same of commerce stocks module's rules :
Add to cart (or updating cart) and during all checkout steps
- If line item qty > line item stock (on chosen date) => cancel add to cart
After checkout
- If total booked line items >= line item stock (on chosen date) => set State calendar on "unavailable"

I thinks this way is the easier as it use many of the features of existing modules, and provide great flexibility.
I need feedbacks on it, in case i'm wrong on specific points. Any help is welcome.

Posted: Oct 2, 2012


happyguilmore on October 9, 2012

I'm actualy testing your concept but at the #5 point I dont understand how to calculate stock from the date field, do you think toi use ru les or make a custom module for this ?

My actual need is to create a reservation system for poker article. Example 16 tables of poker. The user must can reserve 1 or multiple tables but if an other user as reserve 10 tables for on day the other user must see only 6 table available. The system must also permit to purchase some article different from the reservable item. The user can also have the choice to pay an partial payment or a full payment.