User Guide | Installation Guide

Setting up flexi cart is a quick and painless process that can be completed in just a few minutes.

Installing flexi cart

The following notes describe how to install flexi cart to a brand new Codeigniter 2.0 installation.

The guide includes the steps to install either the 'library only' or 'demo' versions of flexi cart.
The library version contains only the essential files required to run flexi cart, the demo version includes all files to run an installation of the online flexi cart demo.

Note that some of the steps listed below may not need to be completed if the flexi cart library is being installed to to a previously setup CodeIgniter installation.


Update the 'config/config.php' file [All Installations]

The following steps may not need to be applied to a previous CodeIgniter installation.

  • Update the 'base_url' to CodeIgniters root installation directory.
    $config['base_url'] = 'http://localhost/your_codeigniter_directory/';
  • Update the 'index_page' config setting to ''. This will remove 'index.php' from the sites urls.
    Note that this is optional, and if done, a '.htaccess' files needs to be included in the root directory of the installation.
    A sample '.htaccess' file is included in the demo.
    $config['index_page'] = '';
  • Update the 'encryption_key' config setting to a value of your choice.
    This is optional, but will improve security with your CodeIgniter installation.
    $config['encryption_key'] = 'YOUR_ENCRYPTION_KEY';
  • Update the 'global_xss_filtering' config setting to TRUE.
    This is optional, but will improve security with your CodeIgniter installation.
    $config['global_xss_filtering'] = TRUE;

This step must be completed to all flexi cart installations.

  • Update the 'sess_use_database' config setting to TRUE. This instructs CodeIgniter to save session data to the database rather than as a browser cookie.
    This is required as the cart session data is too big to store in a cookie.
    $config['sess_use_database'] = TRUE;
Update the 'config/database.php' file [All Installations]

This step must be completed if a database has not been configured with your CodeIgniter installation.

  • Update the database configuration settings located in the 'config/database.php' file to connect to your database.
Update the 'config/routes.php' file [Demo only]

This step is only required if you are installing the flexi cart demo.

  • Update the 'default_controller' to the sites home page.
    $route['default_controller'] = 'lite_library/index';
Copy flexi cart files to CodeIgniter installation [All Installations]

The flexi cart repository is split into two sections, essential 'library files', and optional 'demo files'.

If you wish to install the demo, you will need to install both the 'library files' and the 'demo files'.

Note: Both folders also include an 'sql_dump' folder, see the 'Import SQL database dump' section below for further details.


Installing Library Files

To install the flexi cart library, copy the 'application' folder from 'library_files' to the root Codeigniter folder.

The 'application' folder in the 'library_files' folder includes the following folders and files:

  • config : 'flexi_cart.php'.
  • lanaguge : 'english/flexi_cart_lang.php', (Plus any other language files...).
  • libraries : 'flexi_cart.php', 'flexi_cart_lite.php' and 'flexi_cart_admin.php'.
  • models : 'flexi_cart_model.php', 'flexi_cart_lite_model.php' and 'flexi_cart_admin_model.php'.

Installing Demo Files

To install the flexi cart demo, install the essential library files as described above, then also copy the 'application' and 'includes' folder from 'demo_files' to the root Codeigniter folder.

The 'demo_files' folder includes three folders in the root directory, 'application', 'includes', 'sql_dump' and a '.htaccess' file.

The 'application' folder contains the following folders and files:

  • controllers : 'admin_library.php', 'lite_library.php', 'standard_library.php' and 'user_guide.php',
  • models : 'demo_cart_admin_model.php' and 'demo_cart_model.php'.
  • views : The folders 'demo', 'includes' and 'user_guide' and multiple php files.

The 'includes' folder contains the following folders and files:

  • css : 'global.css', 'jquery.countdown.css' and 'structure.css',
  • images : multiple images used throughout the demo.
  • js : 'admin_global.js', 'global.js', 'jquery.countdown.min.js' and 'jquery.tools.tooltips.min.js'.
Update the '.htaccess' root CodeIgniter directory [Demo / Optional]

If installing the flexi cart demo to a new CodeIgniter installation, you may wish to also copy the '.htaccess' file to the root CodeIgniter directory.
Note that you may need to change the path of the files 'RewriteBase /' to your servers Codeigniter installation.

Example
If the 'base_url' defined via the config file was $config['base_url'] = 'http://localhost/your_codeigniter_directory/'
Then the '.htaccess' file should be updated to RewriteBase /your_codeigniter_directory/.

Define the global cart class [All installations]

For all flexi cart installations, it is important that a global cart class must be defined within all controllers loading the flexi cart library.
The global must be named exactly as stated below and must be defined prior to loading the library.

Example
$this->flexi = new stdClass;
$this->load->library('flexi_cart');.

Update 'base_url' and 'includes_dir' vars [Demo only]

If installing the flexi cart demo, the directories of the 'base_url' and 'includes_dir' vars need to be updated for the demo files to work correctly.

Open each of the demo controllers and update the 'base_url' and 'includes_dir' vars.
These can be found in the constructor of each controller and look like.

$this->load->vars('base_url', 'http://localhost/your_codeigniter_directory/');
$this->load->vars('includes_dir', 'http://localhost/your_codeigniter_directory/includes/');

The 'base_url' must refer to CodeIgniters root installation directory. 'includes_dir' must refer to the demo 'includes' folder.

Import SQL database dump [All installations]

Import the SQL database dump file included with the flexi cart installation to your database.

If you are installing only the library files, install the sql dump within the 'library_files' folder. If installing the demo, install sql dump within the 'demo_files' folder.

The flexi cart 'library_files' folder includes the SQL dump file 'flexi_cart_database_dump.sql', which contains all the essential tables, columns and data that is required to utilise every feature within flexi cart.

The flexi cart 'demo_files' folder includes the SQL dump file 'flexi_cart_demo_database_dump.sql', which contains all the essential tables, but with example data and extra example tables that are utilised by the demo.

That's it!

Next you can start configuring the flexi cart config file and database tables to match the setup that you require.

Once you have configured the site to your requirements, start building the site.

If starting from scratch, check out the demo flexi cart installation for live working examples of using many of the library functions.