HOW TO reserve a room more than 12 months in the future

Talk and help info about common issues

Moderators: ne_moj, zewa

eberswine
Expert
Expert
Posts: 61
Joined: Aug 2nd, '12, 01:54

HOW TO reserve a room more than 12 months in the future

Postby eberswine » Aug 19th, '16, 00:20

Problem-

We want the ability to book a room more than 12 months into the future. The calendar only goes 12 months.

Thanks!

ne_moj
Master
Master
Posts: 243
Joined: Jan 1st, '16, 14:11

Re: Reserve a room more than 12 months in the future.

Postby ne_moj » Aug 19th, '16, 07:53

Hello

This can be easily remedied
Go to the room settings (Hotels Management » Hotels and Rooms » Rooms Settings)

And ispravte setting "Maximum Allowed Search Period"

Regards, Sergey

eberswine
Expert
Expert
Posts: 61
Joined: Aug 2nd, '12, 01:54

Re: Reserve a room more than 12 months in the future.

Postby eberswine » Aug 19th, '16, 14:01

Thanks for the reply.

Unfortunately, I don't have that in my version ??

Image

ne_moj
Master
Master
Posts: 243
Joined: Jan 1st, '16, 14:11

Re: Reserve a room more than 12 months in the future.

Postby ne_moj » Aug 21st, '16, 10:04

Hello

The last example for uHotelBooking if you use ApPHP Hotel Site, you will need to make the following changes:
The file "include/classes/Rooms.class.php"
Find the following code in the code (~ 2720 line):

Code: Select all

$output1 .= '</select>
   <select id="checkin_year_month" name="checkin_year_month" class="checkin_year_month" onchange="cCheckDateOrder(this,\'checkin_monthday\',\'checkin_year_month\',\'checkout_monthday\',\'checkout_year_month\');cUpdateDaySelect(this);">
   <option class="month prompt" value="0">'._MONTH.'</option>';
$selected_year_month = isset($_POST['checkin_year_month']) ? prepare_input($_POST['checkin_year_month']) : date('Y-n');
// !!! Edit only need this line
for($i=0; $i<12; $i++){
   $cur_time = mktime(0, 0, 0, date('m')+$i, '1', date('Y'));
   $val = date('Y', $cur_time).'-'.(int)date('m', $cur_time);
   $output1 .= '<option value="'.$val.'" '.(($selected_year_month == $val) ? 'selected="selected"' : '').'>'.get_month_local(date('n', $cur_time)).' \''.date('y', $cur_time).'</option>';
}
$output1 .= '</select>';
.....
$output2 .= '</select>
   <select id="checkout_year_month" name="checkout_year_month" class="checkout_year_month" onchange="cCheckDateOrder(this,\'checkout_monthday\',\'checkout_year_month\');cUpdateDaySelect(this);">
   <option class="month prompt" value="0">'._MONTH.'</option>';
$checkout_selected_year_month = isset($_POST['checkout_year_month']) ? prepare_input($_POST['checkout_year_month']) : date('Y-n');
// !!! Edit only need this line
for($i=0; $i<12; $i++){
   $cur_time = mktime(0, 0, 0, date('m')+$i, '1', date('Y'));
   $val = date('Y', $cur_time).'-'.(int)date('m', $cur_time);
   $output2 .= '<option value="'.$val.'" '.(($checkout_selected_year_month == $val) ? 'selected="selected"' : '').'>'.get_month_local(date('n', $cur_time)).' \''.date('y', $cur_time).'</option>';
}
$output2 .= '</select>';


And set the desired number of months:

Code: Select all

...
     // 2 year == 24 month
     for($i=0; $i<24; $i++){
...
     // 2 year == 24 month
     for($i=0; $i<24; $i++){
...


And to make the correction in the file templates/default/js/calendar.js (if you are using the default theme). Find following line:

Code: Select all

function cBuildCal(K,E,J){var B=[31,0,31,30,31,30,31,31,30,31,30,31] .... // And a lot of different chars


And set the desired number of months - 1:

Code: Select all

// Edit only need this:
// ... for(n=0;n<=11;n++) ...
// 2 year == 24 month - 1
.... for(n=0;n<=23;n++) ....

eberswine
Expert
Expert
Posts: 61
Joined: Aug 2nd, '12, 01:54

Re: Reserve a room more than 12 months in the future.

Postby eberswine » Aug 22nd, '16, 03:40

Hey super thanks for the try.

The upper select worked, but the bottom one didn't..

I also noticed in the "pop up" calendar, the months did not populate correctly with the +24 ?

Image

Image

Image

ne_moj
Master
Master
Posts: 243
Joined: Jan 1st, '16, 14:11

Re: Reserve a room more than 12 months in the future.

Postby ne_moj » Aug 22nd, '16, 10:05

Hello


1.
To pop-up window appear correct months, check whether there were changes in the file "templates/default/js/calendar.js"

Then make the same changes to the file "templates/admin/js/calendar.js"

After the update the cache to reload the files

2.
Locate the following code in the file "include/classes/Rooms.class.php" (it should be next to the code that you ruled earlier):

Code: Select all

$output2 .= '</select>
   <select id="checkout_year_month" name="checkout_year_month" class="checkout_year_month" onchange="cCheckDateOrder(this,\'checkout_monthday\',\'checkout_year_month\');cUpdateDaySelect(this);">
   <option class="month prompt" value="0">'._MONTH.'</option>';
$checkout_selected_year_month = isset($_POST['checkout_year_month']) ? prepare_input($_POST['checkout_year_month']) : date('Y-n');
// !!! Edit only need this line
for($i=0; $i<12; $i++){
   $cur_time = mktime(0, 0, 0, date('m')+$i, '1', date('Y'));
   $val = date('Y', $cur_time).'-'.(int)date('m', $cur_time);
   $output2 .= '<option value="'.$val.'" '.(($checkout_selected_year_month == $val) ? 'selected="selected"' : '').'>'.get_month_local(date('n', $cur_time)).' \''.date('y', $cur_time).'</option>';
}
$output2 .= '</select>';


And set the number of months:

Code: Select all

...
     // 2 year == 24 month
     for($i=0; $i<24; $i++){
...

eberswine
Expert
Expert
Posts: 61
Joined: Aug 2nd, '12, 01:54

Re: Reserve a room more than 12 months in the future.

Postby eberswine » Aug 22nd, '16, 14:13

That was it!! Brilliant!

Thanks so much!!

ne_moj
Master
Master
Posts: 243
Joined: Jan 1st, '16, 14:11

Re: Reserve a room more than 12 months in the future.

Postby ne_moj » Aug 23rd, '16, 10:05

:)


Return to “ApPHP Hotel Site {HOW TO}”