Integration & JSON/Database structure

The calendar receives and saves data in a JSON format.

JSON Structure

{
    "YYYY-MM-DD":{"available": "", // Number of Available Items
                  "bind": 0, // Set if a day is a part of a group (0 = none; 1 = first day of a group; 2 = in the group; 3 = last day of a group)
                  "info": "", // Day informations
                  "notes": "", // Day notes
                  "price": "", // Price
                  "promo": "", // Promotional Price
                  "status": ""}, // Day status (none, available, booked, special, unavailable)
    // Another day              
    "YYYY-MM-DD":{"available": "",
                  "bind": 0,
                  "info": "",
                  "notes": "",
                  "price": "",
                  "promo": "",
                  "status": ""}
}

You can connect the plugin to your own script to get data using loadURL option

You will receive a POST variable in your script named dopbcp_calendar_id representing Calendar ID. You can pass any variable using GET method.

Make sure you parse the JSON in the above format.

$('#frontend').DOPFrontendBookingCalendarPRO({
    'ID': 1,
    'loadURL': 'your-script.php?var1=value1&var2=value2'
});

You can connect the plugin to your own script to get save using saveURL option.

You will receive 2 POST variables in your script named dopbcp_calendar_id, representing Calendar ID, and dopbcp_schedule, representing the calendar data saved in the above JSON format. You can pass any variable using GET method.

$('#backend').DOPBackendBookingCalendarPRO({
    'ID': 1,
    'saveURL': 'your-script.php?var1=value1&var2=value2'
});

Database Structure

In the example I provide you have 2 fields:

  • id type INT - calendar id
  • data type TEXT - were jSON is saved

Please take into consideration that you can save the JSON into a file or you can break it to save the data into your own database structure.