🏨 Hotel Booking Enhancements: - Implemented Eagle Booking Advanced Pricing add-on - Added Booking.com-style rate management system - Created professional calendar interface for pricing - Integrated deals and discounts functionality 💰 Advanced Pricing Features: - Dynamic pricing models (per room, per person, per adult) - Base rates, adult rates, and child rates management - Length of stay discounts and early bird deals - Mobile rates and secret deals implementation - Seasonal promotions and flash sales 📅 Availability Management: - Real-time availability tracking - Stop sell and restriction controls - Closed to arrival/departure functionality - Minimum/maximum stay requirements - Automatic sold-out management 💳 Payment Integration: - Maintained Redsys payment gateway integration - Seamless integration with existing Eagle Booking - No modifications to core Eagle Booking plugin 🛠️ Technical Implementation: - Custom database tables for advanced pricing - WordPress hooks and filters integration - AJAX-powered admin interface - Data migration from existing Eagle Booking - Professional calendar view for revenue management 📊 Admin Interface: - Booking.com-style management dashboard - Visual rate and availability calendar - Bulk operations for date ranges - Statistics and analytics dashboard - Modal dialogs for quick editing 🔧 Code Quality: - WordPress coding standards compliance - Secure database operations with prepared statements - Proper input validation and sanitization - Error handling and logging - Responsive admin interface 🤖 Generated with Claude Code (https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
64 lines
2.6 KiB
PHP
64 lines
2.6 KiB
PHP
<?php
|
|
|
|
/* --------------------------------------------------------------------------
|
|
* Check room date availability
|
|
* Return Room Available Dates (String)
|
|
* @since 1.0.0
|
|
---------------------------------------------------------------------------*/
|
|
|
|
defined('ABSPATH') || exit;
|
|
|
|
function eb_room_availability($eb_room_id, $eagle_booking_checkin, $eagle_booking_checkout) {
|
|
|
|
global $wpdb;
|
|
|
|
// DB Query
|
|
$eagle_booking_booked_dates = $wpdb->get_results("SELECT date_from, date_to FROM ".EAGLE_BOOKING_TABLE." WHERE id_post = $eb_room_id AND (paypal_payment_status = 'Completed' OR paypal_payment_status = 'Pending Payment') ");
|
|
|
|
// Checked Period
|
|
$eagle_booking_checked_period = eb_total_booking_nights($eagle_booking_checkin, $eagle_booking_checkout);
|
|
|
|
$eagle_booking_room_available_dates = '';
|
|
|
|
if (!empty($eagle_booking_booked_dates)) {
|
|
|
|
foreach ($eagle_booking_booked_dates as $eagle_booking_booked_date) {
|
|
|
|
// Checked Checkin
|
|
$eagle_booking_checked_checkin = DateTime::createFromFormat("m/d/Y", $eagle_booking_checkin)->format('Y/m/d');
|
|
|
|
// Booked Checkin & Checkout
|
|
$eagle_booking_booked_checkin = $eagle_booking_booked_date->date_from;
|
|
$eagle_booking_booked_checkout = $eagle_booking_booked_date->date_to;
|
|
|
|
// Booked Period
|
|
$eagle_booking_booked_period = eb_total_booking_nights($eagle_booking_booked_checkin, $eagle_booking_booked_checkout);
|
|
|
|
// Start Checked Period
|
|
for ($eagle_booking_checked_period_count = 1; $eagle_booking_checked_period_count <= $eagle_booking_checked_period; $eagle_booking_checked_period_count++) {
|
|
|
|
$eagle_booking_booked_checkin_new = DateTime::createFromFormat("m/d/Y", $eagle_booking_booked_checkin)->format('Y/m/d');
|
|
|
|
// Start Booked Period
|
|
for ($eagle_booking_booked_period_count = 1; $eagle_booking_booked_period_count <= $eagle_booking_booked_period; $eagle_booking_booked_period_count++) {
|
|
|
|
if ($eagle_booking_checked_checkin == $eagle_booking_booked_checkin_new) {
|
|
$eagle_booking_room_available_dates .= $eagle_booking_checked_checkin . '-';
|
|
}
|
|
|
|
$eagle_booking_booked_checkin_new = date('Y/m/d', strtotime($eagle_booking_booked_checkin_new . ' + 1 days'));
|
|
|
|
}
|
|
|
|
$eagle_booking_checked_checkin = date('Y/m/d', strtotime($eagle_booking_checked_checkin . ' + 1 days'));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return $eagle_booking_room_available_dates;
|
|
|
|
}
|
|
|
|
}
|