Rates Helper Functions

The helper you can use to create, delete, get and update rates.

function add_rates($rates) {.....}

Supported hooks

Filter name: before_add_rates Description: This filter would be executed before add rate into the database in add_rates helper. Usage:

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

add_filter( ‘before_add_rates’, ‘before_add_rates_callback_fun’, 10, 1 );

function before_add_rates_callback_fun($rates) {
 // code
}

Filter name: should_add_rates Description: This filter would be executed before add rate into database in add_rates helper. Usage:

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

add_filter( ‘should_add_rates’, ‘should_add_rates_callback_fun’, 10, 1 );

function should_add_rates_callback_fun($rates) {
    // code
}

hook name: pre.add.rates Description: This hook would be executed before add rate into the database in add_rates helper. Usage:

hook name: post.add.rates Description: This hook would be executed after add rate into the database in add_rates helper. Usage:

Usage

Request Parameters

Parameters in array format includes following attributes:

Param
Type
Required
Default
Description

rate_plan_id

Integer

Yes

Null

The rate_plan_id of rate plan table for specific rate.

base_rate

Integer

Null

The base_rate for a specific rate.

adult_1_rate

Decimal Integer

Null

The adult_1_rate for a specific rate.

adult_2_rate

Decimal Integer

Null

The adult_2_rate for a specific rate.

adult_3_rate

Decimal Integer

Null

The adult_3_rate for a specific rate.

adult_4_rate

Decimal Integer

Null

The adult_4_rate for a specific rate.

minimum_length_of_stay

Integer

Null

The additional_adult_rate for a specific rate.

closed_to_arrival

Integer

Null

The closed_to_arrival for a specific rate.

additional_child_rate

Decimal Integer

Null

The additional_child_rate for a specific rate.

maximum_length_of_stay

Integer

Null

The maximum_length_of_stay for specific rate.

closed_to_departure

Integer

Null

The closed_to_departure for a specific rate.

can_be_sold_online

Integer

Null

The can_be_sold_online for a specific rate.

additional_adult_rate

Decimal Integer

Null

The additional_child_rate for a specific rate.

Response

function get_rate($rate_id) {....}

Supported hooks

Filter name: before_get_rate Description: This filter would be executed before retrieving rate details from database in get_rate helper. Usage:

Filter name: should_get_rate Description: This filter would be executed before retrieving rate details from database in get_rate helper. Usage:

hook name: pre.get.rate Description: This hook would be executed before retrieving rate details from database in get_rate helper. Usage:

hook name: post.get.rate Description: This hook would be executed after retrieving rate details from database in get_rate helper. Usage:

Usage

Request Parameters

Param
Type
Required
Default
Description

$rate_id

integer

yes

null

The id of the rate corresponds to the rate table

Response

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

Supported hooks

Filter name: before_get_rates Description: This filter would be executed before retrieving rate details from database in get_rates helper. Usage:

Filter name: should_get_rates Description: This filter would be executed before retrieving rate details from database in get_rates helper. Usage:

hook name: pre.get.rates Description: This hook would be executed before retrieving rate details from database in get_rates helper. Usage:

hook name: post.get.rates Description: This hook would be executed after retrieving rate details from database in get_rates helper. Usage:

Usage

Request Parameters

parameter array filter required for rate details.

Param
Type
Required
Default
Description

rate_id

Integer

Yes

Null

The rate id the primary key for a specific rate table.

rate_plan_id

Integer

Yes

Null

The rate plan id for specific rate.

Response

function update_rates($rates , $rate_id) {....}

Usage

Supported hooks

Filter name: before_update_rates Description: This filter would be executed before update rate into the database in update_rates helper. Usage:

Filter name: should_update_rates Description: This filter would be executed before update rate into database in update_rates helper. Usage:

hook name: pre.update.rates Description: This hook would be executed before update rate into the database in update_rates helper. Usage:

hook name: post.update.rates Description: This hook would be executed after update rate into the database in update_rates helper. Usage:

Request Parameters

Request required rate_id and array format data includes following attributes:

Param
Type
Required
Default
Description

rate_id

Integer

Yes

Null

The primary key rate id of rate table for specific rate update.

rate_plan_id

Integer

Yes

Null

The rate_plan_id of rate plan table for specific rate.

base_rate

Integer

Null

The base_rate for a specific rate.

adult_1_rate

Decimal Integer

Null

The adult_1_rate for a specific rate.

adult_2_rate

Decimal Integer

Null

The adult_2_rate for a specific rate.

adult_3_rate

Decimal Integer

Null

The adult_3_rate for a specific rate.

adult_4_rate

Decimal Integer

Null

The adult_4_rate for a specific rate.

minimum_length_of_stay

Integer

Null

The additional_adult_rate for a specific rate.

closed_to_arrival

Integer

Null

The closed_to_arrival for a specific rate.

additional_child_rate

Decimal Integer

Null

The additional_child_rate for a specific rate.

maximum_length_of_stay

Integer

Null

The maximum_length_of_stay for specific rate.

closed_to_departure

Integer

Null

The closed_to_departure for a specific rate.

can_be_sold_online

Integer

Null

The can_be_sold_online for a specific rate.

additional_adult_rate

Decimal Integer

Null

The additional_child_rate for a specific rate.

Response

function delete_rate($rate_id) {.....}

Usage

Request Parameters

Param
Type
Required
Default
Description

$rate_id

integer

yes

null

The id of the rate corresponds to the rate table

Response

Last updated