• Resolved andreaiengo

    (@andreaiengo)


    Hello, I’m creating a website for my Guest House, and I’m very glad to have found your wonderful plugin! Thank you for creating it!
    My request is about 3 features:

    1. minimum stay: I’d need to set up a minimum stay, different in some months (for ex. in august you can book minimum 3 nights, in december minimum 1 night)

    2. I’m offering only private rooms (and I just hidden the “beds” form thanks to the css) but in two different ways for ex:

    twin room (1 people) 25€ whole room
    twin room (2 people) 35€ whole room

    the room is the same, that’s why I got a problem:
    if I use 2 ‘virtual’ rooms (i.e. the same real room is sold as 2 different rooms because of the different price) in the plugin there is the possibility that somebody books “twin room 1 people” and somebody else books “twin room 2 people” and this shan’t be possible, is there a way to choose a “subtype” of the room, or to automatically make unavailable a room when another is booked?

    3. Deposit
    I’d like to set up a deposit that should be payed, instead of the whole payment, when a booking is made and I’d like this deposit would be fixed and not per night, this means that for any kind of booking the host is asked to pay 10€, doesn’t matter if he stays 1 night or 5 nights.

    my website is http://villabenevento.it

    Thank you again, Andrea.

    https://wordpress.org/plugins/hostel/

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author Bob

    (@prasunsen)

    Thanks for your feedback. Item 1 is something we will add soon.
    2 is a bit specific, so I don’t know. Probably you’ll need a piece of custom code.
    3 is available in the pro version.

    Thread Starter andreaiengo

    (@andreaiengo)

    Thank you,
    1. do you have an idea about when are you releasing this update?
    2. do you have any hint about this? Could you tell me where is the code line where it writes in the database? I’m thinking about adding some code line in order to fill the db row related to the ‘other’ room

    Thank you again, Andrea.

    Plugin Author Bob

    (@prasunsen)

    On 1 – a matter of days

    2 – not sure exactly, most probably you’ll need to just edit the query in the booking controller so it books both rooms. Or better edit the availability check code

    Thread Starter andreaiengo

    (@andreaiengo)

    I post the edited code so if anybody else needs the same then me can get an help from it.
    It’s not clean, nor ‘right’ code, but it works in my case, I just have 2 real rooms and I need to have 2 case for any of them, so 4 ‘virtual’ rooms in whole, moreover I need to have just 1 room booked at time, rooms ID are 1,2,3,4 I edited the availability code:
    The function is in wp-content/plugins/hostel/models/room.php

    // figure out availability of a room in given period
    	// room has to be array, not object
    	function availability($room, $bookings, $datefrom, $dateto, $numdays, $datefrom_time, $dateto_time) {
    		for($i=0; $i < $numdays; $i++) {
    				// lets store number of available beds. When they reach 0 the whole room is not available
    				$room['days'][$i]['available_beds'] = $room['beds'];
    				// current day timestamp
    				$curday_time = $datefrom_time + $i*24*3600;
    				foreach($bookings as $booking) {
    
    					if($booking->room_id == '1') { //$room['id']
    						$booking_from_time = strtotime($booking->from_date);
    						$booking_to_time = strtotime($booking->to_date) - 24*3600;
    
    						if($booking_from_time <= $curday_time and $booking_to_time>=$curday_time) {
    							$room['days'][$i]['available_beds'] -= $booking->beds;
    							if($room['days'][$i]['available_beds'] < 0) $room['days'][$i]['available_beds'] = 0;
    							if($booking->is_static or $room['rtype'] == 'private') $room['days'][$i]['available_beds'] = 0;
    							if($room['days'][$i]['available_beds'] <= 0) break;
    						}
    					} // end if this booking is for room 1
    
    					if($booking->room_id == '2') { //$room['id']
    						$booking_from_time = strtotime($booking->from_date);
    						$booking_to_time = strtotime($booking->to_date) - 24*3600;
    
    						if($booking_from_time <= $curday_time and $booking_to_time>=$curday_time) {
    							$room['days'][$i]['available_beds'] -= $booking->beds;
    							if($room['days'][$i]['available_beds'] < 0) $room['days'][$i]['available_beds'] = 0;
    							if($booking->is_static or $room['rtype'] == 'private') $room['days'][$i]['available_beds'] = 0;
    							if($room['days'][$i]['available_beds'] <= 0) break;
    						}
    					} // end if this booking is for room 2
    
    					if($booking->room_id == '3') { //$room['id']
    						$booking_from_time = strtotime($booking->from_date);
    						$booking_to_time = strtotime($booking->to_date) - 24*3600;
    
    						if($booking_from_time <= $curday_time and $booking_to_time>=$curday_time) {
    							$room['days'][$i]['available_beds'] -= $booking->beds;
    							if($room['days'][$i]['available_beds'] < 0) $room['days'][$i]['available_beds'] = 0;
    							if($booking->is_static or $room['rtype'] == 'private') $room['days'][$i]['available_beds'] = 0;
    							if($room['days'][$i]['available_beds'] <= 0) break;
    						}
    					} // end if this booking is for room 3
    
    					if($booking->room_id == '4') { //$room['id']
    						$booking_from_time = strtotime($booking->from_date);
    						$booking_to_time = strtotime($booking->to_date) - 24*3600;
    
    						if($booking_from_time <= $curday_time and $booking_to_time>=$curday_time) {
    							$room['days'][$i]['available_beds'] -= $booking->beds;
    							if($room['days'][$i]['available_beds'] < 0) $room['days'][$i]['available_beds'] = 0;
    							if($booking->is_static or $room['rtype'] == 'private') $room['days'][$i]['available_beds'] = 0;
    							if($room['days'][$i]['available_beds'] <= 0) break;
    						}
    					} // end if this booking is for room 4
    
    				} // end foreach booking
    			} // end for i		
    
    			return $room;
    	} // end availability

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Minimum stay how to lock a room when another is booked deposit’ is closed to new replies.