The helper you can use to create, delete, get and update Tax details.
function add_tax($tax) {.....}
Supported hooks
Filter name: before_add_taxDescription: This filter would be executed before add tax into the database in add_tax helper.
Usage:
// The filter callback function is based on the filter.add_filter( ‘before_add_tax’, ‘before_add_tax_callback_fun’,10,1);functionbefore_add_tax_callback_fun($tax) {// code}
Filter name: should_add_taxDescription: This filter would be executed before add tax into database in add_tax helper.
Usage:
// The filter callback function is based on the filter.add_filter( ‘should_add_tax’, ‘should_add_tax_callback_fun’,10,1);functionshould_add_tax_callback_fun($tax) {// code}
hook name: pre.add.tax
Description: This hook would be executed before add tax into the database in add_tax helper.
Usage:
// The filter callback function is based on the filter.add_action('pre.add.tax','pre_add_tax_callback_fun',10,1);functionpre_add_tax_callback_fun($tax) {// code}
hook name: post.add.tax
Description: This hook would be executed after add tax into the database in add_tax helper.
Usage:
// The filter callback function is based on the filter.add_action('post.add.tax','post_add_tax_callback_fun',10,1);functionpost_add_tax_callback_fun($tax) {// code}
Usage
// for use tax helper you need to add this helper on controller or// you can autoload this helper.$this->load->helper('includes/tax');// add a new tax in tax table.$tax_id =add_tax($tax);
Request Parameters
Parameters in array format includes following attributes:
Response
Response includes the following attributes:
if data have been added successfully it would return the key of specific tax id.
return $tax_id;
if data does not add it will return null.
function get_tax($tax_type_id) {....}
Supported hooks
Filter name: before_get_tax Description: This filter would be executed before retrieving tax details from database in get_tax helper.
Usage:
// The filter callback function is based on the filter.add_filter( ‘before_get_tax’, ‘before_get_tax_callback_fun’,10,1);functionbefore_get_tax_callback_fun($tax_type_id) {// code}
Filter name: should_get_taxDescription: This filter would be executed before retrieving tax details from database in get_tax helper.
Usage:
// The filter callback function is based on the filter.add_filter( ‘should_get_tax’, ‘should_get_tax_callback_fun’,10,1);functionshould_get_tax_callback_fun($tax_type_id) {// code}
hook name: pre.get.tax
Description: This hook would be executed before retrieving tax details from database in get_tax helper.
Usage:
// The filter callback function is based on the filter.add_action('pre.get.tax','pre_get_tax_callback_fun',10,1);functionpre_get_tax_callback_fun($tax_type_id) {// code}
hook name: post.get.tax
Description: This hook would be executed after retrieving tax details from database in get_tax helper.
Usage:
// The filter callback function is based on the filter.add_action('post.get.tax','post_get_tax_callback_fun',10,1);functionpost_get_tax_callback_fun($tax_type_id) {// code}
Usage
// Retrieves tax data based on a tax_type_id.$tax_data =get_tax($tax_type_id);
Request Parameters
Response
// $response array includes following attributes:// $response['tax_type'] : the tax_type of specific tax.// $response['tax_rate'] : the tax_rate for specific tax .// $response['is_percentage'] : the is_percentage for specific tax.// $response['company_id'] : the company_id for specific tax.// $response['is_brackets_active'] : the is_brackets_active for specific tax.// $response['is_tax_inclusive'] : the is_tax_inclusive for specific tax.// $response['start_range'] : the start_range for specific tax price_bracket.// $response['end_range'] : the end_range for specific tax price_bracket.// $response['tax_rate_price_bracket'] : the tax_rate for specific tax price_bracket.// $response['is_percentage_price_bracket'] : the is_percentage for specific tax price_bracket.// and many more attributes for table tax and join with tax_price_bracket table.// Successfully response giving you array of tax data.Array( [tax_type] => gst [tax_rate] =>12.000 [company_id] =>1 [tax_type_id] =>2 [is_deleted] =>0 [is_percentage] =>1 [is_brackets_active] =>1 [is_tax_inclusive] =>0 [start_range] =>12 [end_range] =>19 [price_tax_rate] =>1 [price_percentage] =>1)// if there is no tax data for any tax id provided in input or any error will return null.
function get_taxes($filter) {.....}
Supported hooks
Filter name: before_get_taxesDescription: This filter would be executed before retrieving tax details from database in get_taxes helper.
Usage:
// The filter callback function is based on the filter.add_filter( ‘before_get_taxes’, ‘before_get_taxes_callback_fun’,10,1);functionbefore_get_taxes_callback_fun($filter) {// code}
Filter name: should_get_taxesDescription: This filter would be executed before retrieving tax details from database in get_taxes helper.
Usage:
// The filter callback function is based on the filter.add_filter( ‘should_get_taxes’, ‘should_get_taxes_callback_fun’,10,1);functionshould_get_taxes_callback_fun($filter) {// code}
hook name: pre.get.taxes
Description: This hook would be executed before retrieving tax details from database in get_taxes helper.
Usage:
// The filter callback function is based on the filter.add_action('pre.get.taxes','pre_get_taxes_callback_fun',10,1);functionpre_get_taxes_callback_fun($filter) {// code}
hook name: post.get.taxes
Description: This hook would be executed after retrieving tax details from database in get_taxes helper.
Usage:
// The filter callback function is based on the filter.add_action('post.get.taxes','post_get_taxes_callback_fun',10,1);functionpost_get_taxes_callback_fun($filter) {// code}
Usage
// Retrieves tax data based on a filter array.$tax_data =get_taxes($filter);
Request Parameters
parameter array filter required for tax details.
Response
// $response array includes following attributes:// $response['tax_type'] : the tax_type of specific tax.// $response['tax_rate'] : the tax_rate for specific tax .// $response['is_percentage'] : the is_percentage for specific tax.// $response['company_id'] : the company_id for specific tax.// $response['is_brackets_active'] : the is_brackets_active for specific tax.// $response['is_tax_inclusive'] : the is_tax_inclusive for specific tax.// $response['start_range'] : the start_range for specific tax price_bracket.// $response['end_range'] : the end_range for specific tax price_bracket.// $response['tax_rate_price_bracket'] : the tax_rate for specific tax price_bracket.// $response['is_percentage_price_bracket'] : the is_percentage for specific tax price_bracket.// and many more attributes for table tax and join with tax_price_bracket table.// Successfully response giving you array of tax data.Array( [tax_type] => gst [tax_rate] =>12.000 [company_id] =>1 [tax_type_id] =>2 [is_deleted] =>0 [is_percentage] =>1 [is_brackets_active] =>1 [is_tax_inclusive] =>0 [start_range] =>12 [end_range] =>19 [price_tax_rate] =>1 [price_percentage] =>1)// if there is no tax data for filter provided in input or any error will return null.
function update_tax($tax, $tax_type_id) {....}
Usage
//update tax data based on a update data and tax_type_id.update_tax($tax, $tax_type_id);
Supported hooks
Filter name: before_update_taxDescription: This filter would be executed before updatetax into the database in update_tax helper.
Usage:
// The filter callback function is based on the filter.add_filter( ‘before_update_tax’, ‘before_update_tax_callback_fun’,10,1);functionbefore_update_tax_callback_fun($tax, $tax_type_id) {// code}
Filter name: should_update_taxDescription: This filter would be executed before update tax into database in update_tax helper.
Usage:
// The filter callback function is based on the filter.add_filter( ‘should_update_tax’, ‘should_update_tax_callback_fun’,10,1);functionshould_update_tax_callback_fun($tax, $tax_type_id) {// code}
hook name: pre.update.tax
Description: This hook would be executed before update tax into the database in update_tax helper.
Usage:
// The filter callback function is based on the filter.add_action('pre.update.tax','pre_update_tax_callback_fun',10,1);functionpre_update_tax_callback_fun($tax, $tax_type_id) {// code}
hook name: post.update.tax
Description: This hook would be executed after update tax into the database in update_tax helper.
Usage:
// The filter callback function is based on the filter.add_action('post.update.tax','post_update_tax_callback_fun',10,1);functionpost_update_tax_callback_fun($tax, $tax_type_id) {// code}
Request Parameters
Request required tax_type_id and array format data includes following attributes:
Response
Response return mixed Either true or null if tax data is updated then true else null.
function delete_tax($tax_type_id) {.....}
Usage
// delete a tax data from the tex_type table. it's a soft delete process only status will change data still existing in the backend database.
delete_tax($tax_type_id);
Request Parameters
Response
Response return mixed Either true or null if tax data is deleted then true
else null.