Forum Replies Created

Viewing 6 replies - 1 through 6 (of 6 total)
  • Thread Starter andreaiengo

    (@andreaiengo)

    wow!
    thank you so much!

    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

    Hi, I’m using wordpress 3.9.1 and ceceppa 1.4.27 the bug doesn’t show up immediately, but after few hours, and I can’t foresee which page will be showed up as homepage… it changes time by time…
    At the moment the plugin is disabled and I’m not having this issue.
    I tried the .httacces fix suggested in this post but with no success…

    Anybody knows how to fix this? Is quite annoying… I can also make a permanent fix if it’s avaiable… I just care about having a STATIC homepage…
    Thank you, Andrea.

    I have the same issue, I were getting crazy till I discovered it was the plugin… wondering how I can do to solve this issue…

    Ho lo stesso problema, non riesco a tenere mai la homepage che imposto… ad ogni modifica del sito la home viene sostituita da un’altra pagina (pensavo a caso, ma il post sopra suggerisce che sia semplicemente l’ultima pagina modificata/creata) ho wordpress 3.9.1 e disattivando ceceppa non ho problemi…

    Grazie mille!

    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.

Viewing 6 replies - 1 through 6 (of 6 total)