User Guide | Item Stock Configuration

flexi cart contains many features to aid the custom development of an e-commerce site.
In some instances, some of the features may be considered overkill, or may not require a database table to handle a feature.
In these cases, specific database tables can be disabled, or with some tables, specific columns can be disabled if not required.

In addition to this, the database tables and columns can be renamed to match the custom naming conventions.

Item Stock Configuration

Item Stock Function Index | Get Item Stock Helper Data | Item Stock Admin Data
Config Setup Information

Table Schema Diagram

Table Settings

Item Stock Table

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'.

Item Stock Table Schema Diagram

A database table schema diagram, showing how the item stock table is related to the custom item table.
Note: The custom item table must be created by you. The diagram highlights how it can be related to the item stock table.
Table and columns names are defined using their internal names.

Item Stock Table

Contains stock data on cart items that can be used to indicate whether an item is in stock.

Table and Column Names
Internal Name Default Name Data Type Description
table item_stock - The tables name.
id stock_id int The tables primary key.
Important Note: See the note highlighted below regarding the table id and the item id.
item stock_item_fk int Relates the stock quantity to an item (product).
The value acts as a foreign key relating the table to the primary key of a custom item (product) table.
quantity stock_quantity int The items stock quantity.
auto_allocate_status stock_auto_allocate_status bool Defines whether the cart should auto allocate the stock quantity on a specific item.
The parameter allows the items stock quantity to be checked and displayed, but prevents the value being updated by any cart functions.
If the column is disabled, all item stock quantities will be auto allocated.

If the table is enabled, then the 'item' and 'quantity' columns are required, all disabled columns must be set as 'FALSE'.

The table containing the item stock data does not need to be a table dedicated to just item stock data.
As the stock data has a one-to-one relationship with an item, (i.e. one item can only have one stock quantity) the stock data columns could be included in a custom user defined item table.


IMPORTANT NOTE: If the stock data columns are included in a user defined item table, the 'id' column must be set to FALSE as the 'item' column will become the primary key column.

// Example #1 : Defining the table and column names.

$config['database']['item_stock']['table'] = 'item_stock';
$config['database']['item_stock']['columns']['id'] = 'stock_id';
// Example #2 : Disabling the table.

$config['database']['item_stock']['table'] = FALSE;