plugin_path . 'includes/models/methods-api.php'; $method = new Methods(); include $controller->plugin_path . 'includes/translations/translations.php'; $txt = new Translation; $checkin_date = sanitize_text_field($_POST['param1']); $checkout_date = sanitize_text_field($_POST['param2']); $guest_number = sanitize_text_field($_POST['param3']); $checkin_timestamp = strtotime($checkin_date); $checkout_timestamp = strtotime($checkout_date); //echo $checkin_date.$checkout_date.$guest_number; $vat = $method->has_get_settings('vat_percentage'); ?>
has_get_room_type(); foreach ($room_types as $row): /** * * Counting the number of available rooms for each room type. * */ global $wpdb; $room_counter = 0; $room_type_id = $row['room_type_id']; $room = $wpdb->prefix . 'hotel_has_room'; $query_result = $wpdb->get_results("SELECT * FROM `$room` WHERE `room_type_id` = $room_type_id ", ARRAY_A); foreach ($query_result as $row1): $exclude_flag = false; /** * * Flag variable for checking if a room is available for booking * * If a room is already in booking status within the asked checkin & checkout timestamp * * Checking within the room booking history of a single room * */ $booking_room = $wpdb->prefix . 'hotel_has_booking_room'; $room_id = $row1['room_id']; $query_result2 = $wpdb->get_results("SELECT * FROM `$booking_room` WHERE `room_id` = $room_id", ARRAY_A); foreach ($query_result2 as $row2): if ($checkin_timestamp >= $row2['checkin_timestamp'] && $checkin_timestamp < $row2['checkout_timestamp']){ $exclude_flag = true; break; } if ($checkout_timestamp > $row2['checkin_timestamp'] && $checkout_timestamp <= $row2['checkout_timestamp']){ $exclude_flag = true; break; } if ($checkin_timestamp <= $row2['checkin_timestamp'] && $checkout_timestamp >= $row2['checkout_timestamp']){ $exclude_flag = true; break; } endforeach; /** * * Exclude this room from available list * */ if ($exclude_flag == true){ continue; } else{ $room_counter++; } endforeach; /** * * Hide the room type that doesn't have available rooms. * */ if ($room_counter == 0){ continue; } /** * * 1 Room price of the type, within the date range * */ $room_price = $method->has_get_room_price($room_id, $checkin_timestamp, $checkout_timestamp); ?>
has_currency($room_price); ?> / txt("room") ?>
txt($row2);?>

get_amenity_name_by_id($row2); ?>

txt("Max Guests") ?> -

txt("Room Quantity") ?>