public function ajaxProcessProductRoomsBookingDetailsOnMonthChange() { $month = Tools::getValue('month'); $year = Tools::getValue('year'); $query_date = $year . '-' . $month . '-04'; $start_date = date('Y-m-01', strtotime($query_date)); // hard-coded '01' for first day $last_day_this_month = date('Y-m-t', strtotime($query_date)); $hotel_id = Tools::getValue('id_hotel'); $room_type = Tools::getValue('id_product'); $adult = Tools::getValue('num_adults'); $children = Tools::getValue('num_children'); $num_rooms = 1; $obj_booking_dtl = new HotelBookingDetail(); while ($start_date <= $last_day_this_month) { $cal_date_from = $start_date; $cal_date_to = date('Y-m-d', strtotime($cal_date_from) + 86400); $booking_calendar_data[$cal_date_from] = $obj_booking_dtl->getBookingData($cal_date_from, $cal_date_to, $hotel_id, $room_type, $adult, $children, $num_rooms, 1); $start_date = date('Y-m-d', strtotime($start_date) + 86400); } if ($booking_calendar_data) { die(Tools::jsonEncode($booking_calendar_data)); } else { die(0); } }