Jump to content

Best way to setup room availability.


Jon
 Share

Recommended Posts

Hello All,

Iam just looking for some advice on how you would setup the following. Its for a  cruise company that have two different boats and offer a number of different cruises on different dates. For the first part Ive gone for The cruise with the children for each date, Which works well.

This is where it starts getting a bit complicated each boat has a number of different rooms (both boats are not the same setup either) and some prices vary. 

What I want to do is make it as easy as possible for the client when they have to input new dates for cruises.

What I have done initially was setup all the fields for both boats within the child dates and used a select field to pick the boat for that particular date. Based on that field selection I've set the room(s) and availability from hooking into the Save. But this way doesn't seem to offer the best flexibility. I now thinking maybe Pro Tables might be the way forward? What I want to avoid is the client needing to setup the room(s) for the date. (But they will still also need access to adjust the availability).

Just really what way different people might approach this?

Cheers

Jon

Link to comment
Share on other sites

Sounds like you would want to handle 5 data types:

  • boats
  • rooms
  • cruises
  • customers
  • bookings

A boat I'm assuming has a fixed number of rooms.

Perhaps start with a data model like this which takes everything into consideration:

  1. Boats (boats.php)
    1. Boat A (boat.php)
      1. Room 1 (room.php)
      2. Room 2
      3. Room 3
      4. ...
    2. Boat B
      1. Room 1
      2. Room 2
      3. ...
  2. Customers (customers.php)
    1. Customer 1 (customer.php)
    2. Customer 2
    3. ...
  3. Bookings (bookings.php)
    1. Booking 1 (booking.php)
    2. Booking 2
    3. ...
  4. Cruises (cruises.php)
    1. Cruise 1 (cruise.php)
    2. Cruise 2
    3. ...

Cruise template fields:

  1. title
  2. date
  3. boat (page-select to /boats/, boat.php)

Customer template fields:

  1. first name
  2. last name
  3. (other typical fields)

Cruise template fields:

  1. title
  2. boat (page-select to /boats/, boat.php)
  3. date

Booking template fields:

  1. customer (page-select to /customers/, customer.php)
  2. cruise (page-select to /cruise/, cruise.php)
  3. rooms (based on cruise->boat, select for the rooms that the boat has)

I'm assuming the interface would be PW's admin.  Perhaps use some hooks and ListerPro to tie it all together.  Make it as user-friendly as possible.  Maybe have a page within the admin outputs each cruise with which rooms have been booked vs. unbooked which would be friendly to the site admins.

 

Edited by Jonathan Lahijani
consider a booking can be multiple rooms
  • Like 5
Link to comment
Share on other sites

13 hours ago, Jonathan Lahijani said:

To what extent are you storing a customer's information as part of booking a room?  Or do you simply just need to indicate whether a room is taken?

I planned to just include the customer information within the booking page. 

I see how you have split the boats/rooms away from the dates. But then how would you go about managing the rooms books and keeping track of that? Query the bookings every time or store availability within dates?  

Link to comment
Share on other sites

When making a new booking, you have the 'room' dropdown (well perhaps it should be "Rooms" since one customer may be able to book more than one room) as I described, however you obviously don't want to a room to be double-booked, meaning that dopdown should only show available/unbooked rooms.

You can determine that by writing a custom query for that ASM-select field (using PW's Custom PHP Code feature).

I think the selector would be something like (well you'd need to finish it off and also make it handle whether the current booking has a room selected):

// this will find all the unbooked rooms of the selected boat
$wire->addHookAfter('InputfieldPage::getSelectablePages', function($event) {
  if($event->object->name == 'rooms') {
    $booking = $this->pages->get($this->input->id);
    $cruise = $booking->cruise;
    $boat = $cruise->boat;
    $allRooms = $boat->children;
    $availableRooms = new PageArray();
    foreach($allRooms as $room) {
      if( ! $this->pages->count("write query here to determine if the room has been booked") ) {
        $availableRooms->add($room);
      }
    }
    $event->return = $availableRooms;
  }
});

Hope this helps.

  • Like 2
Link to comment
Share on other sites

  • 2 weeks later...

Hello Jonathan, 

Thanks for your reply, Ive put together the site in a similar structure to what you mentioned above. One of my front end pages will list all the cruises for a year (potentially) which shows the availability in terms of spaces (this is one I done in the past to give you a idea http://www.themajesticline.co.uk/calendar/?title=&cruise_month=&cruise_year=2017&submit=Search).  

To produce the number of spaces available for this new site. I thinking I will need to query the booking for all rooms booked for each cruise. Then calculate the spaces from that. Would that be the way you would approach this? 

Cheers

Jon

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...