Jon Posted January 14, 2017 Share Posted January 14, 2017 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 More sharing options...
Jonathan Lahijani Posted January 14, 2017 Share Posted January 14, 2017 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? Link to comment Share on other sites More sharing options...
Jonathan Lahijani Posted January 14, 2017 Share Posted January 14, 2017 (edited) 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: Boats (boats.php) Boat A (boat.php) Room 1 (room.php) Room 2 Room 3 ... Boat B Room 1 Room 2 ... Customers (customers.php) Customer 1 (customer.php) Customer 2 ... Bookings (bookings.php) Booking 1 (booking.php) Booking 2 ... Cruises (cruises.php) Cruise 1 (cruise.php) Cruise 2 ... Cruise template fields: title date boat (page-select to /boats/, boat.php) Customer template fields: first name last name (other typical fields) Cruise template fields: title boat (page-select to /boats/, boat.php) date Booking template fields: customer (page-select to /customers/, customer.php) cruise (page-select to /cruise/, cruise.php) 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 January 14, 2017 by Jonathan Lahijani consider a booking can be multiple rooms 5 Link to comment Share on other sites More sharing options...
Jon Posted January 14, 2017 Author Share Posted January 14, 2017 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 More sharing options...
Jonathan Lahijani Posted January 14, 2017 Share Posted January 14, 2017 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. 2 Link to comment Share on other sites More sharing options...
Jon Posted January 26, 2017 Author Share Posted January 26, 2017 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 More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now