Option to make some hotels/rooms "unbookable" online

Discuss everything related to PHP Hotel Site. All versions. Any questions related to the PHP Hotel Site developing or using should be posted to this forum.

Moderator: alexandrleonenko

PrinceOfAbyss
Junior
Junior
Posts: 17
Joined: Apr 1st, '18, 23:17

Option to make some hotels/rooms "unbookable" online

Postby PrinceOfAbyss » Apr 19th, '18, 17:28

I need to make some rooms unbookable from the online reservation system, due to the fact that some other agencies may work with them.

So for those particular rooms, I will need to display a Contact us button in place of the Reserve button.

I know what to do, but I'm worried that I'll overlook some places where I'll have to alter the code.

Basically I'll add a tinyint(1) 0/1field ("switch") in rooms table similar to the active field. I'll also add the functionality to set/reset that field admin panel.

The problem is in the display of the results after you submit the check availability form. I'm a little confused as there are some places where the results are displayed, and I'm afraid that I'll overlook some of them.

Any help would be much appreciated.

PrinceOfAbyss
Junior
Junior
Posts: 17
Joined: Apr 1st, '18, 23:17

Re: Option to make some hotels/rooms "unbookable" online

Postby PrinceOfAbyss » Apr 20th, '18, 00:22

Nevermind! I was able to figure it out.

There are two Reserve buttons in public function DrawSearchResult(), one for when the returned rooms are from multiple hotels, and the second when they are from a single hotel. Then in the same method there is an AJAX button that switches between Reserve and Remove through AJAX if enabled.

There are three more, but in methods I'm not using (public function DrawWidgetSearchResult(), and private static function DrawWidgetRoomItem()) so I won't bother dealing with those.

For the first two, I'll add an if statement with my new field "is_bookable" to determine whether I'll show the Reserve button, or a Contact us faux button. About the AJAX button, I won't deal with it either, because if the room is already booked, it must be a bookable one, and if it's not, it won't have a Reserve button from the initial check.

However, while I was experimenting to figure out what each button does, I discovered a serious problem in my installation.

Should I mention it here, or should I open a separate thread for it?

PrinceOfAbyss
Junior
Junior
Posts: 17
Joined: Apr 1st, '18, 23:17

Re: Option to make some hotels/rooms "unbookable" online

Postby PrinceOfAbyss » Apr 20th, '18, 02:03

Nevermind, fortunately this was easy to debug... There is a well hidden setting named TYPE_FILTER_TO_NUMBER_ROOMS which by default is set to "hotel", so obviously the script counts the room quantity as the hotel quantity (or something along these lines), and didn't allow me to reserve two rooms from the same hotel, if both of them had a quantity of 1. Changing the setting to "rooms" corrected the issue.

TBH, it still confuses me why it counts them as negative (-2), but since my problem was solved I won't bother debugging it anymore...

reserve_two_from_same.PNG
reserve_two_from_same.PNG (131.63 KiB) Viewed 413 times


Return to “ApPHP HotelSite / uHotelBooking Talk {developers/users}”