Availability Helper Functions

The helper you can use to get room availability details in the company.

function get_availability($filter) {....}

Supported hooks

Filter name: before_get_availability Description: This filter would be executed before retrieving availability details from database in get_availability helper. Usage:

// The filter callback function is based on the filter.

add_filter( ‘before_get_availability’, ‘before_get_availability_callback_fun’, 10, 1 );

function before_get_availability_callback_fun($filter) {
// code
}

Filter name: should_get_availability Description: This filter would be executed before retrieving availability details from the database in the get_availability helper. Usage:

// The filter callback function is based on the filter.

add_filter( ‘should_get_availability’, ‘should_get_availability_callback_fun’, 10, 1 );

function should_get_availability_callback_fun($filter) {
// code
}

hook name: pre.get.availability Description: This hook would be executed before retrieving availability details from the database in the get_availability helper. Usage:

// The filter callback function is based on the filter.

add_action('pre.get.availability', 'pre_get_availability_callback_fun', 10, 1);

function pre_get_availability_callback_fun($filter) {
// code
}

hook name: post.get.availability Description: This hook would be executed after retrieving availability details from the database in the get_availability helper. Usage:

// The filter callback function is based on the filter.

add_action('post.get.availability', 'post_get_availability_callback_fun', 10, 1);

function post_get_availability_callback_fun($filter) {
// code
}

Usage

// for use company helper you need to add this helper on controller or
// you can autoload this helper.
$this->load->helper('includes/availability');

// Retrieves room availability data based on the filter.
$availability_data = get_availability($filter);

Request Parameters

Param array $filter (Required)  for availability details.

Response

// Response array includes multiple array of availability for room type have following attributes:
// $response['id'] : the id of specific room types.
// $response['company_id'] : the company_id for specific room types.
// $response['rate_plan_count'] : the rate_plan_count for specific room types.
// $response['max_occupancy'] : the max_occupancy for specific room types.
// $response['max_adult'] : the max_adult for specific room types.
// $response['max_children'] : the max_children for specific room types.
// $response['default_room_charge'] : the default_room_charge for specific room types.
// $response['date_start'] : the date_start for specific room availability.
// $response['date_end'] : the date_end for specific room availability.
// $response['availability'] : the availability for specific room availability.
// $response['max_availability'] : the max_availability for specific room availability.
// $response['max_availability'] : the name for specific room availability.
// $response['inventory_sold'] : the inventory_sold for specific room availability.
// and many more attributes from availability and join with room , room type table.

// Successfully response giving you array of availability data.

Array
(
    [2] => Array
        (
            [id] => 2
            [name] => Sample Room Type
            [company_id] => 1
            [acronym] => SRT
            [is_deleted] => 0
            [max_occupancy] => 6
            [min_occupancy] => 1
            [max_adults] => 2
            [max_children] => 1
            [image_group_id] => 5
            [description] => 
            [can_be_sold_online] => 1
            [ota_close_out_threshold] => 1
            [sort] => 0
            [default_room_charge] => 1
            [prevent_inline_booking] => 0
            [rate_plan_count] => 2
            [availability] => Array
                (
                    [0] => Array
                        (
                            [date_start] => 2022-02-02
                            [date_end] => 2022-02-03
                            [date] => 2022-02-03
                            [availability] => 3
                            [max_availability] => 4
                            [inventory_sold] => 0
                            [closeout_status] => 1
                        )

                )

        )

    [3] => Array
        (
            [id] => 3
            [name] => Super Room Type
            [company_id] => 1
            [acronym] => NRT
            [is_deleted] => 0
            [max_occupancy] => 11
            [min_occupancy] => 1
            [max_adults] => 4
            [max_children] => 4
            [image_group_id] => 6
            [description] => 
            [can_be_sold_online] => 1
            [ota_close_out_threshold] => 1
            [sort] => 0
            [default_room_charge] => 1
            [prevent_inline_booking] => 0
            [rate_plan_count] => 2
            [availability] => Array
                (
                    [0] => Array
                        (
                            [date_start] => 2022-02-02
                            [date_end] => 2022-02-03
                            [date] => 2022-02-03
                            [availability] => 2
                            [max_availability] => 3
                            [inventory_sold] => 0
                            [closeout_status] => 1
                        )

                )

        )

// if there is no availability data for filter provided in input or any error will return null.        

Last updated