User Guide | Libraries

flexi cart is split into three different libraries each with their own individual purpose.

Lite Library

The lite library contains functions that typically read data from the cart session or database, and barring status and error messages, it does not set any data to the cart session or database.

It is called the 'lite' library as it used by both the standard and admin libraries, but to save memory usage, can be instantiated by itself for pages that do not need the functionality of the standard or admin libraries.

When loaded by itself, it typically uses approximately 800kb of memory which is around 60% lighter than when loaded together with the standard and admin libraries.

The typical functions available from the lite library can return any data that is set in the cart session data, this includes cart item data, cart summary data, localisation and configuration data.


Examples
// Loading the lite library.

$this->load->library('flexi_cart_lite');
// Loading the lite library using a different object name.

// When loading the lite library, it may be more convenient to rename the library object, 
// for example to 'flexi_cart' or 'flexi_cart_admin'.

$this->load->library('flexi_cart_lite', FALSE, 'flexi_cart');

Standard Library

The standard library contains the core functionality of the cart, with functions to insert and update items to the cart, and update the localisation and configuration settings.

The standard library automatically loads the lite library when instantiated, so all functions that are available in the lite library, are also available when the standard library has been loaded.

When loaded, the standard library typically uses approximately 1800kb of memory. To minimize the memory usage on the server, it is recommended that the standard library should only be loaded on pages that are actively setting data to the cart, like the actual cart management page. For all other pages that do not need to set data, either use the lite library to still access cart data, or do not load a library at all; the cart session data is not lost if a library is not loaded.

Note: Unlike with the lite library, do NOT rename the library object to any other name when loading this library as it will cause conflicts in some internal functions.


Examples
// Loading the standard library.

$this->load->library('flexi_cart');

Admin Library

The admin library contains a variation of SQL CRUD style functions and helper functions to manage data within the cart database tables.

Like the standard library, the admin library automatically loads the lite library when instantiated, meaning that all the functions in the lite library are also available when the admin library has been loaded.

The admin library uses approximately 1800kb of memory when loaded, and other than the save order and database cart data functions, the library would typically only need to be used in the back-end of the e-commerce site, to help admins manage the functionality of the cart.

Note: Unlike with the lite library, do NOT rename the library object to any other name when loading this library as it will cause conflicts in some internal functions.


Examples
// Loading the admin library.

$this->load->library('flexi_cart_admin');