Zero logo

OpenCart

OpenCart is a free and open source shopping cart application providing an online e-commerce solution. The following page provides detailed information for installing OpenCart on Uniform Server XII and how to run it with SSL. Also covered is portability allowing OpenCart to run from a USB memory stick or another location.

The following guide assumes you are installing OpenCart in a sub-folder named shop.
This is accessible using http://your.domain.com/shop/ for example test server use (http://localhost/shop/)

Running third party scripts such as OpenCart requires Uniform Server's SSL default behaver to be modified this is covered in section "SSL secure main server."

Note: At Step D you are required to enter your e-mail address this is the e-mail address you set as default when configuring MSMTP, for details see Edit MSMTP Configuration

SSL secure main server.

A default installation of Uniform Server contains a separate folder (ssl) preconfigured specifically for a personal secure server. To run third party scripts such as OpenCart requires this default behaver to be modified such that SSL secures only the main server.

The Apache SSL configuration must be modified to secure only the main server as follows:

  • Edit file UniServerZ\core\apache2\conf\extra\httpd-ssl.conf
  • Locate two instances of ${US_ROOTF_SSL} and replace with ${US_ROOTF_WWW}

Note: With the above modifications folder ssl becomes redundant and is no longer used.

Create a self-signed certificate

Create a self-signed server certificate or see documentation Apache - Free Server Certificate to obtain and install a certificate issued by a certificate authority.

Generate a self-signed certificate as follows:

  • Start UniController
  • Select Apache > Apache SSL > Server Certificate and Key generator
  • This opens the Server Certificate and Key generator menu shown at right
  • D) Click Run Generate After a short time, a confirmation pop-up is displayed.

After generating server certificate Uniform Server is SSL enabled.

Start as program

Step A: Download and Extract

Download and unzip the OpenCart package.

  • Download the latest version of OpenCart from http://www.opencart.com/?route=download/download. currently v1.5.6.3
  • Save the downloaded file opencart-1.5.6.3.zip to a temporary folder for example C:\opencart_temp
  • Extract, right click on file opencart-1.5.6.3.zip, select Extract All, click next and next again.
    (For Windows 8: Right click on file opencart-1.5.6.3.zip, select 7-zip Extract files.. )

Before OpenCart can be installed a MySQL user and database are required for details see Step B.

Step B: Create the Database and a User using phpMyAdmin

Follow these instructions to create your OpenCart username and database using phpMyAdmin.

Note: These instructions are written for phpMyAdmin 4.1.13; the phpMyAdmin user interface can vary slightly between versions.

  • Start UniController.
  • Start Apache and MySQL servers.
  • Click phpMyAdmin button - Opens phpMyAdmin in default browser.
  1. If a OpenCart database does not already exist in the Database list on the left, create one:
    1. Click Databases button top left menu bar.
    2. Choose a name for your OpenCart database ('opencart' or 'cart' are good), enter it in the Create database field, and click Create.
      Note: Database name added to list on the left.
  2. Click the Users button top menu bar. If a user relating to OpenCart does not already exist in the list of users, create one:
    1. Click Add user this opens the add user menu, navigate to the Login Information section:
    2. Choose a username for OpenCart ('opencart' is good) and enter it in the User name field. (Be sure Use text field: is selected from the dropdown.)
    3. From the Host dropdown select Use text field: in the Host field enter 127.0.0.1
    4. Choose a difficult-to-guess password (ideally containing a combination of upper- and lower-case letters, numbers, and symbols), and enter it in the Password field. (Be sure Use text field: is selected from the dropdown.) Re-enter the password in the Re-type field.
    5. Write down the username and password you chose.
    6. Leave all options under Database for user and Global privileges at their defaults.
    7. Click Go.
  3. You are returned to the Users screen.
    1. Click Edit privileges for the user you've just created for OpenCart.
    2. In the Database-specific privileges section, (Add privileges on the following database:) select the database you've just created for OpenCart.
    3. The page will refresh with privileges for that database. Click Check All to select all privileges
    4. Click Go.

Note: Other parts of this documentation assume you have set the following: OpenCart database name = opencart Username for OpenCart = opencart Password = fred123 remember to replace these with the values you have set in the above.

Step C: Upload the files

Note: The location of your root web directory www will vary depending where Uniform Server was installed.
A default installation assumes the following path C:\UniServerZ\www

Copy the OpenCart upload directory into the root directory of your web site.

  • Copy folder C:\opencart_temp\opencart-1.5.6.3\opencart-1.5.6.3\upload to folder C:\UniServerZ\www
  • Rename folder C:\UniServerZ\www\upload to C:\UniServerZ\www\shop
  • Rename file C:\UniServerZ\www\shop\config-dist.php to C:\UniServerZ\www\shop\config.php
  • Rename file C:\UniServerZ\www\shop\admin\config-dist.php to C:\UniServerZ\www\shop\admin\config.php

Step D: OpenCart Installation

The following assumes you have Apache and MySQL servers running. To start the OpenCart installation:

  • Type the following into your browser address bar: http://localhost/shop/ - This will redirect to the installation page.

The installation process consists of four pages as follows:

STEP 1 - LICENSE
Explains the GNU General Public. Click Continue

STEP 2 - PRE-INSTALLITION
The following four sections list installation requirements for OpenCart:

  1. Please configure your PHP settings to match requirements listed below.
  2. Please make sure the PHP extensions listed below are installed.
  3. Please make sure you have set the correct permissions on the files list below.
  4. Please make sure you have set the correct permissions on the directories list below.

Uniform Server defaults meet all the above requirements click Continue

STEP 3 - CONFIGURATION
Enter parameters in the following two sections:

1. Please enter your database connection details.

Database Driver: MySQLi - Use default no need to change
Database host: 127.0.0.1 - Do not use default localhost
User: opencart - Name of the database user you created.
Password: fred123 - The password you created for the database user
Database Name: opencart - The name of the database to use
Database Prefix: oc_ - Use default no need to change

2. Please enter a username and password for the administration.

Username: Mike - A name of your choice for admin
Password: Mike123 - Choose a difficult-to-guess password
E-mail: mike@xxx.com - Use your real e-mail address.

That completes configuration click Continue.

STEP 4 - Finished
Page displays, Congratulations! You have successfully installed OpenCart.

Login to administration.

  • Click the Login to your Administration button. Login menu is displayed.
    • Note: To re-login at any time type http://localhost/shop/admin/ into your browser.
  • Enter name and password (Mike Mike123) you set for the administrator. Click Login
  • Continue to next section (Enabling SSL in the OpenCart Dashboard)

Enabling SSL in the OpenCart Dashboard

The following assumes you are logged into admin, if not see note above. To enable SSL in the OpenCart Dashboard proceed as follows:

  1. Go to System > Settings
  2. To the right of “Your Store (Default)” click Edit
  3. Click on the Server tab
  4. In the Use SSL section check the radio button Yes.
  5. Click Save
  6. Logout

Finally delete folder: C:\UniServerZ\www\shop

Enabling SSL in the OpenCart directory - config.php file

Edit file C:\UniServerZ\www\shop\config.php
Locate these lines:

// HTTPS
define('HTTPS_SERVER', 'http://localhost/shop/');
Change to:
// HTTPS
define('HTTPS_SERVER', 'https://localhost/shop/');

Enabling SSL in the OpenCart Admin directory - config.php file

Edit file: UniServerZ\www\shop\admin\config.php
Locate these lines:

// HTTPS
define('HTTPS_SERVER', 'http://localhost/shop/admin/');
define('HTTPS_CATALOG', 'http://localhost/shop/');
Change to:
// HTTPS
define('HTTPS_SERVER', 'https://localhost/shop/admin/');
define('HTTPS_CATALOG', 'https://localhost/shop/');

That completes installation. Close browser and restart servers.

Test

Test the installion as follows:

  • Type the following into browser: http://localhost/shop/ Expected result example cart content is displayed.
  • Add an item to the cart and click checkout. Result your browser is forced to a secure connection and displays closed padlock. If requested by your browser add an exception.
  • Type the following into browser: http://localhost/shop/admin/
  • Enter name and password (Mike Mike123) you set for the administrator. Expected result your browser is again forced to a secure connection and displays closed padlock.

Portability

Paths in the two configuration (config.php) files use absolute paths. This restricts the above installation to a fixed location, meaning Uniform Server and OpenCart cannot be moved to a different location. However OpenCart is easily converted for portability allowing the complete server to run from either a USB memory stick or moved to another location.

Note: Paths in your config.php files may be different to those shown, however the replacement sections can be used with no modification.

Edit file: C:\UniServerZ\www\shop\config.php
Locate this section:

// DIR
define('DIR_APPLICATION', 'C:\UniServerZ\www\shop/catalog/');
define('DIR_SYSTEM', 'C:\UniServerZ\www\shop/system/');
define('DIR_DATABASE', 'C:\UniServerZ\www\shop/system/database/');
define('DIR_LANGUAGE', 'C:\UniServerZ\www\shop/catalog/language/');
define('DIR_TEMPLATE', 'C:\UniServerZ\www\shop/catalog/view/theme/');
define('DIR_CONFIG', 'C:\UniServerZ\www\shop/system/config/');
define('DIR_IMAGE', 'C:\UniServerZ\www\shop/image/');
define('DIR_CACHE', 'C:\UniServerZ\www\shop/system/cache/');
define('DIR_DOWNLOAD', 'C:\UniServerZ\www\shop/download/');
define('DIR_LOGS', 'C:\UniServerZ\www\shop/system/logs/');

Replace with:

// DIR
$root= substr($_SERVER["DOCUMENT_ROOT"],0,-4);   // Get path
define('DIR_APPLICATION', $root . '\www\shop/catalog/');
define('DIR_SYSTEM',      $root . '\www\shop/system/');
define('DIR_DATABASE',    $root . '\www\shop/system/database/');
define('DIR_LANGUAGE',    $root . '\www\shop/catalog/language/');
define('DIR_TEMPLATE',    $root . '\www\shop/catalog/view/theme/');
define('DIR_CONFIG',      $root . '\www\shop/system/config/');
define('DIR_IMAGE',       $root . '\www\shop/image/');
define('DIR_CACHE',       $root . '\www\shop/system/cache/');
define('DIR_DOWNLOAD',    $root . '\www\shop/download/');
define('DIR_LOGS',        $root . '\www\shop/system/logs/');

Edit file: C:\UniServerZ\www\shop\admin\config.php
Locate this section:

// DIR
define('DIR_APPLICATION', 'I:\UniServerZ\www\shop/admin/');
define('DIR_SYSTEM', 'I:\UniServerZ\www\shop/system/');
define('DIR_DATABASE', 'I:\UniServerZ\www\shop/system/database/');
define('DIR_LANGUAGE', 'I:\UniServerZ\www\shop/admin/language/');
define('DIR_TEMPLATE', 'I:\UniServerZ\www\shop/admin/view/template/');
define('DIR_CONFIG', 'I:\UniServerZ\www\shop/system/config/');
define('DIR_IMAGE', 'I:\UniServerZ\www\shop/image/');
define('DIR_CACHE', 'I:\UniServerZ\www\shop/system/cache/');
define('DIR_DOWNLOAD', 'I:\UniServerZ\www\shop/download/');
define('DIR_LOGS', 'I:\UniServerZ\www\shop/system/logs/');
define('DIR_CATALOG', 'I:\UniServerZ\www\shop/catalog/');

Replace with:

// DIR
$root= substr($_SERVER["DOCUMENT_ROOT"],0,-4);   // Get path
define('DIR_APPLICATION', $root . '\www\shop/admin/');
define('DIR_SYSTEM',      $root . '\www\shop/system/');
define('DIR_DATABASE',    $root . '\www\shop/system/database/');
define('DIR_LANGUAGE',    $root . '\www\shop/admin/language/');
define('DIR_TEMPLATE',    $root . '\www\shop/admin/view/template/');
define('DIR_CONFIG',      $root . '\www\shop/system/config/');
define('DIR_IMAGE',       $root . '\www\shop/image/');
define('DIR_CACHE',       $root . '\www\shop/system/cache/');
define('DIR_DOWNLOAD',    $root . '\www\shop/download/');
define('DIR_LOGS',        $root . '\www\shop/system/logs/');
define('DIR_CATALOG',     $root . '\www\shop/catalog/');

Test portability

Test the installion for portability as follows:

  • If running stop servers
  • Close UniController
  • Rename folder C:\UniServerZ to C:\UniServerZ_opencart
  • Start UniController. Then start Apache and MySQL servers
  • Type the following into browser: http://localhost/shop/ Expected result example cart content is displayed.
  • Add an item to the cart and click checkout. Result your browser is forced to a secure connection and displays closed padlock. If requested by your browser add an exception.
  • Type the following into browser: http://localhost/shop/admin/
  • Enter name and password (Mike Mike123) you set for the administrator. Expected result your browser is again forced to a secure connection and displays closed padlock.

--oOo--