Rate Plan Helper Functions
The helper you can use to create, delete, get and update Rate Plan details.
Supported hooks
Filter name: before_get_rate_plan
Description: This filter would be executed before retrieving rate_plan details from database in get_rate_plan helper.
Usage:
add_filter('before_get_rate_plan', 'before_get_rate_plan_callback_fn', 10, 1);
function before_get_rate_plan_callback_fn ($rate_plan_id) {
// This filter would be executed before retrieving rate_planfrom database in get_rate_plan helper.
}
Filter name: should_get_rate_plan
Description: This filter would be executed before retrieving rate_plan details from database in get_rate_plan helper.
Usage:
add_filter('should_get_rate_plan', 'should_get_rate_plan_callback_fn', 10, 1);
function should_get_rate_plan_callback_fn ($rate_plan_id) {
// This filter would be executed before retrieving rate_plan details from database in get_rate_plan helper.
}
Hook name : pre.get.rate_plan
Description: This hook would be executed before retrieving rate_plan details from database in get_rate_plan helper.
Usage:
add_filter('pre.get.rate_plan', 'pre_get_rate_plan_callback_fn', 10, 1);
function pre_get_rate_plan_callback_fn ($rate_plan_id) {
// This filter would be executed before retrieving rate_plan details from database in get_rate_plan helper.
}
Hook name : post.get.rate_plan
Description: This hook would be executed after retrieving rate_plan details from database in get_rate_plan helper.
Usage:
add_filter('post.get.rate_plan', ' post_get_rate_plan_callback_fn', 10, 1);
function post_get_rate_plan_callback_fn ($rate_plan_id) {
// This filter would be executed before retrieving rate_plan details from database in get_rate_plan helper.
}
Usage
// for use rate plan helper you need to add this helper on controller or
// you can autoload this helper.
$this->load->helper('includes/rate_plan');
// Retrieves rate plan data based on a rate_plan_id.
$rate_plan_data = get_rate_plan($rate_plan_id);
Request Parameters
Param | Type | Required | Default | Description |
---|---|---|---|---|
$rate_plan_id | integer | yes | null | The id of the rate plan corresponds to the rate plan table |
Response
// $response array includes following attributes:
Array
(
[rate_plan_id] => 2
[rate_plan_name] => Super Rate Plan
[room_type_id] => 3
[charge_type_id] => 1
[description] =>
[is_deleted] =>
[number_of_adults_included_for_base_rate] => 4
[currency_id] => 151
[base_rate_id] => 2
[is_selectable] => 1
[image_group_id] => 8
[is_shown_in_online_booking_engine] => 1
[company_id] => 1
[parent_rate_plan_id] =>
[policy_code] =>
[date_time] => 2021-12-10 12:01:01
[rate_id] => 2
[base_rate] =>
[adult_1_rate] =>
[adult_2_rate] =>
[adult_3_rate] =>
[adult_4_rate] =>
[additional_adult_rate] =>
[additional_child_rate] =>
[minimum_length_of_stay] =>
[maximum_length_of_stay] =>
[minimum_length_of_stay_arrival] =>
[maximum_length_of_stay_arrival] =>
[closed_to_arrival] =>
[closed_to_departure] =>
[can_be_sold_online] => 1
)
//if there is no rate plan data for any rate plan id provided in input or any error will return null.
Filter name: before_add_rate_plan
Description: This filter would be executed before add rate plan into the database in add_rate_plan helper.
Usage:
// The filter callback function is based on the filter.
add_filter( ‘before_add_rate_plan’, ‘before_add_rate_plan_callback_fun’, 10, 1 );
function before_add_rate_plan_callback_fun($rate_plan) {
// code
}
Filter name: should_add_rate_plan
Description: This filter would be executed before add rate plan into database in add_rate_plan helper.
Usage:
// The filter callback function is based on the filter.
add_filter( ‘should_add_rate_plan’, ‘should_add_rate_plan_callback_fun’, 10, 1 );
function should_add_rate_plan_callback_fun($rate_plan) {
// code
}
hook name: pre.add.rate_plan
Description: This hook would be executed before add rate plan into the database in add_rate_plan helper.
Usage:
// The filter callback function is based on the filter.
add_action('pre.add.rate_plan', 'pre_add_rate_plan_callback_fun', 10, 1);
function pre_add_rate_plan_callback_fun($rate_plan) {
// code
}
hook name: post.add.rate_plan
Description: This hook would be executed after add rate plan into the database in add_rate_plan helper.
Usage:
// The filter callback function is based on the filter.
add_action('post.add.rate_plan', 'post_add_rate_plan_callback_fun', 10, 1);
function post_add_rate_plan_callback_fun($rate_plan) {
// code
}
Usage
// for use rate plan helper you need to add this helper on controller or
you can autoload this helper.
$this->load->helper('includes/rate_plan');
//add a new rate plan in rate_plan table.
$rate_plan_id = add_rate_plan($rate_plan);
Request Parameters
Parameters in array format includes following attributes:
Param | Type | Required | Default | Description |
---|---|---|---|---|
rate_plan_name | Character | Yes | Null | The rate_plan_name of specific rate_plan. |
room_type_id | Integer | | 0 | The room_type_id for specific rate_plan. |
charge_type_id | Integer | | 0 | The charge_type_id for specific rate_plan. |
description | Text | | Null | The description of specific rate_plan. |
number_of_adults_included_for_base_rate | Integer | | 4 | The number of adults included for base_rate in a rate plan. |
currency_id | Integer | | Null | The currency_id for specific rate_plan. |
base_rate_id | Integer | | Null | The base_rate_id for specific rate_plan. |
is_selectable | Integer | | 1 | The is_selectable for specific rate_plan. |
is_shown_in_online_booking_engine | Integer | | 1 | it's shown in online_booking_engine for a specific rate plan. |
company_id | Integer | Yes | Null | The company_id for a specific rate plan. |
parent_rate_plan_id | Integer | | Null | The parent_rate_plan_id for specific rate_plan. |
policy_code | Character | | Null | The policy_code for specific rate_plan. |
Response
Response includes the following attributes:
if data have been added successfully it would return the key of specific rate_plan_id.
return $rate_plan_id;
if data does not add it will return null.
Supported hooks
Filter name: before_get_rate_plans
Description: This filter would be executed before retrieving rate_plan details from database in get_rate_plans helper.
Usage:
// The filter callback function is based on the filter.
add_filter( ‘before_get_rate_plans’, ‘before_get_rate_plans_callback_fun’, 10, 1 );
function before_get_rate_plans_callback_fun($filter) {
// code
}
Filter name: should_get_rate_plans
Description: This filter would be executed before retrieving rate_plan details from database in get_rate_plans helper.
Usage:
// The filter callback function is based on the filter.
add_filter( ‘should_get_rate_plans’, ‘should_get_rate_plans_callback_fun’, 10, 1 );
function should_get_rate_plans_callback_fun($filter) {
// code
}
hook name: pre.get.rate_plans
Description: This hook would be executed before retrieving rate_plan details from database in get_rate_plans helper.
Usage:
// The filter callback function is based on the filter.
add_action('pre.get.rate_plans', 'pre_get_rate_plans_callback_fun', 10, 1);
function pre_get_rate_plans_callback_fun($filter) {
// code
}
hook name: post.get.rate_plans
Description: This hook would be executed after retrieving rate_plan details from database in get_rate_plans helper.
Usage:
// The filter callback function is based on the filter.
add_action('post.get.rate_plans', 'post_get_rate_plans_callback_fun', 10, 1);
function post_get_rate_plans_callback_fun($filter) {
// code
}
Usage
// Retrieves rate_plan data based on a filter array.
$rate_plan_data = get_rate_plans($filter);
Request Parameters
parameter array filter required for charge details.
Param | Type | Required | Default | Description |
---|---|---|---|---|
rate_plan_name | Character | Yes | Null | The description for a specific charge. |
company_id | Integer | Yes | Null | The booking_id for specific charge. |
room_type_id | Integer | Yes | Null | The customer_id for a specific charge. |
Response
// $response array includes following attributes:
// $response['key'] : the key of specific rate_plan
// $response['rate_plan_name'] : the rate_plan_name of specific rate_plan.
// $response['room_type_id'] : the room_type_id for specific rate_plan.
// $response['charge_type_id'] : the charge_type_id for specific rate_plan.
// $response['description'] : the description for specific rate_plan.
// $response['company_id'] : the company_id for specific rate_plan.
// $response['number_of_adults_included_for_base_rate'] : the number_of_adults_included_for_base_rate for specific rate_plan.
// and many more attributes from table rate_plan.
// Successfully response giving you array of rate plan data.
Array
(
[0] => Array
(
[rate_plan_id] => 1
[rate_plan_name] => simple Rate Plan
[room_type_id] => 2
[charge_type_id] => 1
[description] =>
[is_deleted] => 0
[number_of_adults_included_for_base_rate] => 4
[currency_id] => 151
[base_rate_id] => 1
[is_selectable] => 1
[image_group_id] => 7
[is_shown_in_online_booking_engine] => 1
[company_id] => 1
[parent_rate_plan_id] =>
[policy_code] =>
[date_time] => 2021-12-10 12:00:45
)
)
// if there is no rate plan data for filter provided in input or any error will return null.
Usage
// update rate_plan data based on rate_plan update data and rate_plan_id.
update_rate_plan($rate_plan, $rate_plan_id);
Supported hooks
Filter name: before_update_rate_plan
Description: This filter would be executed before update rate_plan into the database in update_rate_plan helper.
Usage:
// The filter callback function is based on the filter.
add_filter( ‘before_update_rate_plan’, ‘before_update_rate_plan_callback_fun’, 10, 1 );
function before_update_rate_plan_callback_fun($rate_plan, $rate_plan_id) {
// code
}
Filter name: should_update_rate_plan
Description: This filter would be executed before update rate_plan into database in update_rate_plan helper.
Usage:
// The filter callback function is based on the filter.
add_filter( ‘should_update_rate_plan’, ‘should_update_rate_plan_callback_fun’, 10, 1 );
function should_update_rate_plan_callback_fun($rate_plan, $rate_plan_id) {
// code
}
hook name: pre.update.rate_plan
Description: This hook would be executed before update rate_plan into the database in update_rate_plan helper.
Usage:
// The filter callback function is based on the filter.
add_action('pre.update.rate_plan', 'pre_update_rate_plan_callback_fun', 10, 1);
function pre_update_rate_plan_callback_fun($rate_plan, $rate_plan_id) {
// code
}
hook name: post.update.rate_plan
Description: This hook would be executed after update rate_plan into the database in update_rate_plan helper.
Usage:
// The filter callback function is based on the filter.
add_action('post.update.rate_plan', 'post_update_rate_plan_callback_fun', 10, 1);
function post_update_rate_plan_callback_fun($rate_plan, $rate_plan_id) {
// code
}
Request Parameters
Request required rate_plan_id and array format data includes following attributes:
Param | Type | Required | Default | Description |
---|---|---|---|---|
rate_plan_id | Integer | Yes | Null | The primary key of rate plan table for specific rate plan. |
rate_plan_name | Character | Yes | Null | The rate_plan_name of specific rate_plan. |
room_type_id | Integer | | 0 | The room_type_id for specific rate_plan. |
charge_type_id | Integer | | 0 | The charge_type_id for specific rate_plan. |
description | Text | | Null | The description of specific rate_plan. |
number_of_adults_included_for_base_rate | Integer | | 4 | The number of adults included for base_rate in a rate plan. |
currency_id | Integer | | Null | The currency_id for specific rate_plan. |
base_rate_id | Integer | | Null | The base_rate_id for specific rate_plan. |
is_selectable | Integer | | 1 | The is_selectable for specific rate_plan. |
is_shown_in_online_booking_engine | Integer | | 1 | it's shown in online_booking_engine for a specific rate plan. |
company_id | Integer | Yes | Null | The company_id for a specific rate plan. |
parent_rate_plan_id | Integer | | Null | The parent_rate_plan_id for specific rate_plan. |
policy_code | Character | | Null | The policy_code for specific rate_plan. |
Response
Response return mixed Either true or null if rate plan data is updated then true else null.
Usage
// delete a rate plan data from the rate plan table. it's a soft delete process only status will change data still existing in the backend database.
delete_rate_plan($rate_plan_id);
Request Parameters
Param | Type | Required | Default | Description |
---|---|---|---|---|
$rate_plan_id | integer | yes | null | The id of the rate plan corresponds to the rate plan table |
Response
Response return mixed Either true or null if rate data is deleted then true
else null.
Last modified 1yr ago