User Guide | Admin Tax Functions

Admin functions are available from the flexi cart admin library and are primarily used to manage data within flexi carts database tables.

Many of the functions perform CRUD functionality returning SELECT queries and running INSERT, UPDATE and DELETE statements.
The CRUD functions are automatically joined to other related tables and allow custom statements to be run, with minimal configuration required.

Admin Tax Functions

Tax Function Index | Tax Config | Get Tax Session Data | Set Tax Session Data

Help with Admin Functions

Show / Hide Help

Name: The name of the function (method).

Data Type: The data type that is expected by the function.

  • bool : Requires a boolean value of 'TRUE' or 'FALSE'.
  • string : Requires a textual value.
  • int : Requires a numeric value. It does not matter whether the value is an integer, float, decimal etc.
  • array : Requires an array.

Required: Defines whether the parameter requires a value to be submitted.

Default: Defines the default parameter value that is used if no other value is submitted.

get_db_tax()

Gets records from the tax table.


Library and Requirements

Available via the admin library only.

Requires the tax database table to be enabled.

Function Parameters
get_db_tax(sql_select, sql_where) Help
Name Data Type Required Default Description
sql_select string | array No FALSE Define the database fields returned via an SQL SELECT statement.
Read the defining SQL documentation for further information.
sql_where string | int | array No FALSE Set the SQL WHERE statement used to filter the database records to return.
Read the defining SQL documentation for further information.
How it Works

The function runs an SQL SELECT statement on the 'Tax' table.

The query can be customised by submitting 'sql_select' and 'sql_where' data to the functions parameters.

Notes

This function is compatible with flexi carts 'Query Builder' functions.


This function can be chained with CodeIgniters query functions 'result()', 'row()' etc.

Read the Query Result documentation for further information on all the combined flexi cart and CodeIgniter functions that are available.


If an int value is submitted to the 'sql_where' parameter, the function will automatically match the value against the tables primary key.
Example: If 'sql_where' is submitted as an int of '101', the SQL WHERE statement will be "WHERE 'primary_key_column' = 101".

Return Values

Failure:FALSE | An error message will be set if a required table/feature is disabled.

Success:object

Example
// Read the defining SQL documentation for further information on setting SQL statements.
$sql_select = array(...);
$sql_where = array(...);

// Example of chaining CI's query function 'result()'.
// Read the Query Result documentation for further information on available functions.
$this->flexi_cart_admin->get_db_tax($sql_select, $sql_where)->result();

insert_db_tax()

Inserts a new record to the tax table.


Library and Requirements

Available via the admin library only.

Requires the discount database tables to be enabled.

Function Parameters
insert_db_tax(sql_insert) Help
Name Data Type Required Default Description
sql_insert array Yes FALSE Set the SQL INSERT statement used to insert data into the database.
Read the defining SQL documentation for further information.
How it Works

The function runs an SQL INSERT statement on the 'Tax' table, inserting data defined via the 'sql_insert' parameter.

Return Values

Failure:FALSE | An error message will be set if a required table/feature is disabled.

Success:int | id of the inserted record.

Example
// Read the defining SQL documentation for further information on setting SQL statements.
$sql_insert = array(...);

$this->flexi_cart_admin->insert_db_tax($sql_insert);

update_db_tax()

Updates records in the tax table.


Library and Requirements

Available via the admin library only.

Requires the discount database tables to be enabled.

Function Parameters
update_db_tax(sql_update, sql_where) Help
Name Data Type Required Default Description
sql_update array Yes FALSE Set the SQL UPDATE statement used to update data into the database.
Read the defining SQL documentation for further information.
sql_where string | int | array No FALSE Set the SQL WHERE statement used to filter the database records to update.
Read the defining SQL documentation for further information.
How it Works

The function runs an SQL UPDATE statement on the 'Tax' table, updating data defined via the 'sql_update' parameter and filtered via the 'sql_where' parameter.

Notes

This function is compatible with flexi carts 'Query Builder' functions.


If an int value is submitted to the 'sql_where' parameter, the function will automatically match the value against the tables primary key.
Example: If 'sql_where' is submitted as an int of '101', the SQL WHERE statement will be "WHERE 'primary_key_column' = 101".

Return Values

Failure:FALSE | An error message will be set if a required table/feature is disabled.

Success:int | The number of affected rows.

Example
// Read the defining SQL documentation for further information on setting SQL statements.
$sql_update = array(...);
$sql_where = array(...);

$this->flexi_cart_admin->update_db_tax($sql_update, $sql_where);

delete_db_tax()

Deletes records from the tax table.


Library and Requirements

Available via the admin library only.

Requires the discount database tables to be enabled.

Function Parameters
delete_db_tax(sql_where) Help
Name Data Type Required Default Description
sql_where string | int | array Yes FALSE Set the SQL WHERE statement used to filter the database records to delete.
Read the defining SQL documentation for further information.
How it Works

The function runs an SQL DELETE statement on the 'Tax' table filtered via the 'sql_where' parameter.

Notes

This function is compatible with flexi carts 'Query Builder' functions.


If an int value is submitted to the 'sql_where' parameter, the function will automatically match the value against the tables primary key.
Example: If 'sql_where' is submitted as an int of '101', the SQL WHERE statement will be "WHERE 'primary_key_column' = 101".

Return Values

Failure:FALSE | An error message will be set if a required table/feature is disabled.

Success:int | The number of affected rows.

Example
// Read the defining SQL documentation for further information on setting SQL statements.
$sql_where = array(...);

$this->flexi_cart_admin->delete_db_tax($sql_where);