Order Configuration
Order Function Index |
Get Order Session Data |
Get Order Helper Data |
Order Admin Data
Help with the Table Configuration
Show / Hide Help
Internal Name: The name that flexi cart internally references the table or column by.
Default Name: The default table or column name used in the actual table.
Data Type: The data type that is expected by the table column.
- bool : Requires a boolean value set as either '0' (FALSE) or '1' (TRUE).
- string : Requires a textual value.
- int : Requires a numeric value. It does not matter whether the value is an integer, float, decimal etc.
Config File Location
The config file is located in CodeIgniters 'config' folder and is named 'flexi_cart.php'.
Order Tables Schema Diagram
A database table schema diagram, showing how the order tables are related to each other and the cart data, custom item and user tables.
Note: The custom item and user tables must be created by you. The diagram highlights how they can be related to the order tables.
Table and columns names are defined using their internal names.
Order Summary Table
The order tables are designed to relate any data available from the cart session to a database column.
When saving the cart to the database, any table columns that are related to item and summary data in the cart will be automatically saved to the database.
Table and Column Names
Help
Internal Name |
Default Name |
Data Type |
Description |
table |
order_summary |
- |
The tables name. |
order_number |
ord_order_number |
string |
The tables primary key.
Column Required.
|
cart_data |
ord_cart_data_fk |
int |
Relates the order to the ordered carts session data that if enabled, is saved to the database when an order is placed.
The value acts as a foreign key relating the table to the primary key of the cart data table.
See the 'Requirements' below for further information.
|
user |
ord_user_fk |
int |
Relates the order to a user.
The value CAN be used to act as a foreign key relating the table to the primary key of a custom user table, although this is not joined by default.
|
item_summary_total |
ord_item_summary_total |
int |
The total value of all items in the order. |
item_summary_savings_total |
ord_item_summary_savings_total |
int |
The total savings value of all discounts that were applied items in the order. |
shipping_name |
ord_shipping |
string |
The name of the shipping option selected to ship the order by. |
shipping_total |
ord_shipping_total |
int |
The total shipping value. |
item_shipping_total |
ord_item_shipping_total |
int |
The total value of all items in the order plus the shipping total. |
summary_discount_description |
ord_summary_discount_desc |
string |
A description of any discounts that were applied to the order summary. |
summary_savings_total |
ord_summary_savings_total |
int |
The total savings value of any discounts that were applied to the order summary columns. |
savings_total |
ord_savings_total |
int |
The total savings value of any discounts that were applied to the order. |
surcharge_description |
ord_surcharge_desc |
string |
A description of any surcharges that were applied to the order. |
surcharge_total |
ord_surcharge_total |
int |
The total value of any surcharges that were applied to the order. |
reward_voucher_description |
ord_reward_voucher_desc |
string |
A description of any reward vouchers that were applied to the order. |
reward_voucher_total |
ord_reward_voucher_total |
int |
The total value of any reward vouchers that were applied to the order. |
tax_rate |
ord_tax_rate |
string |
The carts tax rate formatted to include a percentage sign. |
tax_total |
ord_tax_total |
int |
The total value of all taxes applied to the order. |
total |
ord_total |
int |
The total value of the order. |
total_rows |
ord_total_rows |
int |
The total number of rows that were present in the cart. |
total_items |
ord_total_items |
int |
The total number of items that were ordered. |
total_weight |
ord_total_weight |
int |
The total weight of all items in the order. |
total_reward_points |
ord_total_reward_points |
int |
The total reward points earnt by the order. |
currency_name |
ord_currency |
string |
The currency that the user was displaying prices as when they placed the order. |
exchange_rate |
ord_exchange_rate |
int |
The exchange rate of the currency that the user was displaying prices as when they placed the order. |
status |
ord_status |
int |
Relates the order to the order statuses.
The value acts as a foreign key relating the table to the primary key of the order status table.
Column Required.
|
date |
ord_date |
string | int |
The date and time that the order was placed.
The data type of this column can either be mysql datetime or a unix timestamp.
Read the internal config documentation regarding setting the carts date and time settings.
Column Required.
|
Requirements
If the table is enabled, then the 'Order Details' and 'Order Status' table must be enabled too.
The related cart data table and custom item and user tables do not need to be enabled to use order tables.
The 'order_number', 'status' and 'date' columns are the only required columns, all disabled columns must be set as 'FALSE'.
The 'cart_data' column must be enabled if saved cart data is to be reloaded from a saved order.
Example
$config['database']['order_summary']['table'] = 'order_summary';
$config['database']['order_summary']['columns']['order_number'] = 'ord_order_number';
$config['database']['order_summary']['columns']['savings_total'] = FALSE;
$config['database']['order_summary']['table'] = FALSE;
Order Summary Searchable Columns
The library includes a function to search the order summary table via keywords using the search_orders() function.
By default, the config file is not defined with any searchable order summary columns as keyword based search terms would typically be associated with custom columns that are added by the developer to the order summary table.
Example
$config['database']['order_summary']['search_order_cols'] = array(
'custom_column_1',
'custom_column_2',
'custom_column_3'
);
Order Details Table
Contains the saved order details of each cart item row as an individual row in the database.
Table and Column Names
Help
Internal Name |
Default Name |
Data Type |
Description |
table |
order_details |
- |
The tables name. |
id |
ord_det_id |
int |
The tables primary key.
Column Required.
|
order_number |
ord_det_order_number_fk |
string |
Relates the order detail to the unique reference number of the order summary.
The value acts as a foreign key relating the table to the primary key of the order summary table.
Column Required.
|
cart_row_id |
ord_det_cart_row_id |
int |
The unique row id of the item when it was in the cart.
See the 'Requirements' below for further information.
|
item_id |
ord_det_item_fk |
int |
The unique table id of the ordered item.
The value CAN be used to act as a foreign key relating the table to the primary key of a custom item (product) table, although this is not joined by default.
See the 'Requirements' below for further information.
|
item_name |
ord_det_item_name |
string |
The name and description of the ordered item. |
item_options |
ord_det_item_option |
string |
The selected options (if any) of the ordered item. |
item_quantity |
ord_det_quantity |
int |
The quantity of items ordered. |
item_non_discount_quantity |
ord_det_non_discount_quantity |
int |
The quantity of items ordered that were not discounted. |
item_discount_quantity |
ord_det_discount_quantity |
int |
The quantity of items ordered that were discounted. |
item_stock_quantity |
ord_det_stock_quantity |
int |
The stock quantity level at the time the order was placed.
The quantity does not deduct the ordered quantity of items from the stock level.
|
item_price |
ord_det_price |
int |
The price of each ordered item. |
item_price_total |
ord_det_price_total |
int |
The total price of ordered items. |
item_discount_price |
ord_det_discount_price |
int |
The discount price of each ordered item. |
item_discount_price_total |
ord_det_discount_price_total |
int |
The total price of ordered items including any applied discounts. |
item_discount_description |
ord_det_discount_description |
string |
A description of any discount applied to the item. |
item_tax_rate |
ord_det_tax_rate |
int |
The non formatted tax rate applied to the ordered item. |
item_tax |
ord_det_tax |
int |
The tax value of each ordered item. |
item_tax_total |
ord_det_tax_total |
int |
The total tax value of ordered items. |
item_shipping_rate |
ord_det_shipping_rate |
int |
The shipping rate of each ordered item. |
item_weight |
ord_det_weight |
int |
The weight of each ordered item. |
item_weight_total |
ord_det_weight_total |
int |
The total weight of ordered items. |
item_reward_points |
ord_det_reward_points |
int |
The reward points earnt for each ordered item. |
item_reward_points_total |
ord_det_reward_points_total |
int |
The total reward points earnt for all ordered items. |
item_status_message |
ord_det_status_message |
string |
The item status message that was present when the order was placed.
This typically states an items stock or shipping status.
|
item_quantity_shipped |
ord_det_quantity_shipped |
int |
The quantity of ordered items that have been shipped since the order was placed.
See the 'Requirements' below for further information.
|
item_quantity_cancelled |
ord_det_quantity_cancelled |
int |
The quantity of ordered items that have been cancelled since the order was placed.
See the 'Requirements' below for further information.
|
item_shipped_date |
ord_det_shipped_date |
string | int |
The date and time that the ordered item was first shipped.
The data type of this column can either be mysql datetime or a unix timestamp.
See the 'Requirements' below for further information.
Read the internal config documentation regarding setting the carts date and time settings.
|
Requirements
If the table is enabled, then the 'Order Summary' and 'Order Status' table must be enabled too.
The related cart data table and custom item and user tables do not need to be enabled to use order tables.
The 'id' and 'order_number' columns are the only required columns, all disabled columns must be set as 'FALSE'.
The 'cart_row_id' column must be enabled if original order data is to be preserved when using the resave_order() function.
The 'item_id' column must be enabled if the config setting auto_allocate_stock is also enabled.
The 'item_quantity', 'item_quantity_shipped', 'item_quantity_cancelled', and 'item_shipped_date' columns must be enabled if the shipped and cancelled quantity of ordered items is to be validated by flexi cart. These quantities are also required for reward point calculations.
Example
$config['database']['order_details']['table'] = 'order_details';
$config['database']['order_details']['columns']['id'] = 'ord_det_id';
$config['database']['order_details']['columns']['item_discount_price'] = FALSE;
$config['database']['order_details']['table'] = FALSE;
Order Detail Custom Table Columns
The order detail custom columns are designed to relate custom data that has been added to the cart session data, to custom table columns that have been added to the order details table.
The purpose being that when an order is saved, the custom data in the carts session will be automatically inserted to the order details table without having to define it to do so.
To setup the custom table columns, an array is created that relates the name of the custom cart column that is to be saved, to the table column name where the value is saved to.
Read the cart column documentation for further information on defining custom cart columns.
Example
$config['cart']['items']['custom_columns'] = array(
array(
'name' => 'user_note',
'required' => FALSE,
'regex' => FALSE,
'decimals' => FALSE,
'default' => NULL,
'updatable'=> TRUE
)
);
$config['database']['order_details']['custom_columns'] = array(
'user_note' => 'ord_det_demo_user_note'
);
Order Status Table
Contains the order statuses that are used to indicate the progress of an order.
Table and Column Names
Help
Internal Name |
Default Name |
Data Type |
Description |
table |
order_status |
- |
The tables name. |
id |
ord_status_id |
int |
The tables primary key. |
status |
ord_status_description |
string |
The name and description of the order status. |
cancelled |
ord_status_cancelled |
bool |
Defines whether the status indicates that the order has been cancelled. |
save_default |
ord_status_save_default |
bool |
Defines whether the status is the default status that an order should be set with when first placed. |
resave_default |
ord_status_resave_default |
bool |
Defines whether the status is the default status that an order should be set with when re-saved. |
Requirements
If the table is enabled, then all columns are required and the 'Order Summary' and 'Order Details' table must be enabled too.
The related cart data table and custom item and user tables do not need to be enabled to use order tables.
Example
$config['database']['order_status']['table'] = 'order_status';
$config['database']['order_status']['columns']['id'] = 'ord_status_id';
$config['database']['order_status']['table'] = FALSE;