Availability Table for hotel

9 posts by 3 authors in: Forums > CMS Builder
Last Post: June 18, 2008   (RSS)

Re: [chassa2556] Availability Table for hotel

By Dave - June 9, 2008

What would be the easiest for your client to edit? What if we have a multi page editor with a record for each month and then a checkbox field for each day of the month (1 through 31).

So they'd click: Bookings > June > Then check off 1 through 31 for the days that were booked. Do you think that that would work for them?
Dave Edis - Senior Developer
interactivetools.com

Re: [Dave] Availability Table for hotel

By chassa2556 - June 16, 2008

Yes that would probably work. How would one do this?

Re: [chassa2556] Availability Table for hotel

By Dave - June 16, 2008

Create a new multi-record section called "Bookings" with these fields:

month
- Make this a list field
- Have options for: January, February, March, etc
- Make the field required and unique

Then create checkbox fields for: day1, day2 ... day31

Then create a record for each month and check the days they are booked.

Let me know when you get all that setup, then we can create the viewers for it.
Dave Edis - Senior Developer
interactivetools.com

Re: [Dave] Availability Table for hotel

By Djulia - June 17, 2008

Hi Dave,

I would like to also take part in this discussion.

I prepared the first proposal above.

You can indicate the code to be used for the viewer?

Thank you for your assistance. [:)]

Djulia

Re: [Dave] Availability Table for hotel

By Djulia - June 17, 2008

I have an error message when I created a recording.

Notice: Undefined offset: 1 in ../lib/menus/default/save.php on line 235
MySQL Error: Incorrect integer value: '' for column '1' at row 1

The problem seems to come with the use of the checkbox.

An idea ?

Thanks, Djulia

Re: [Djulia] Availability Table for hotel

By Dave - June 17, 2008

Hi Djulia,

Which version are you running? Can you list the steps you followed that caused that error so I can re-create it myself?

For the viewer, I was just thinking some of simple code to display the available / not available status for each day. Something like this for each month:

list($bookingRecords, $bookingMetaData) = getRecords(array(
'tableName' => 'bookings',
'where' => 'month = "January"',
'loadUploads' => '0',
'allowSearch' => '0',
));
$jan = @$bookingRecords[0];

// sample code
if ($jan['day21']) { echo "January 21st Booked!"; }
else { echo "January 21st Not Booked!"; }


Where you'd test the monthly variable to see if a day was booked or not.

Having a second look at this, I guess you'd really need the calendar generated as well? Do you have a mockup of your current calendar, Djulia?
Dave Edis - Senior Developer
interactivetools.com

Re: [Dave] Availability Table for hotel

By Djulia - June 17, 2008 - edited: June 17, 2008

Thank you for your answer. [:)]

>> Which version are you running?
[/#808040]I use the version 1.17[/#000000]

>> Can you list the steps you followed that caused that error so I can re-create it myself?[/#808040]
The problem is caused if File Name (used in PHP viewer code) has a numerical value (1, 2,3…) for the checkbox fields (Field Type). (error.gif and created-a-recording.gif)

There is not this error if I use the value "day1".
(no-error.gif)

An idea ?

Djulia

Re: [Djulia] Availability Table for hotel

By Dave - June 18, 2008

Thanks for reporting this. It looks like all numeric fieldnames cause problems in PHP when we merge arrays.

For now just try adding some letters (d1, etc) and it will work fine. I'll add some code to the next version to allow that and we'll do some testing to make sure it doesn't cause any problems.

Hope that helps.
Dave Edis - Senior Developer
interactivetools.com