E-commerce applications come in all shapes and sizes, ranging from storefront solutions that generate Web pages, to bolt-on shopping carts that can be added to existing sites with product listings. There is also a wide range of costs, ranging from completely free to completely overpriced. For Web developers who wish to modify an e-commerce application for a client, there is also a range of code availability, ranging from entirely open source to entirely locked down (typically using some sort of PHP encoder).
In this tutorial, I will give an introduction to CubeCart, created and distributed by Devellion Limited. Their flagship product is one of the easiest low-cost e-commerce solutions available, and is growing in popularity. Note that CubeCart is not technically open source, since the code cannot be freely redistributed. On the other hand, most of the code is not protected using encoding, and can thus be read and understood.
CubeCart utilizes PHP, XHTML, and CSS — thankfully using divs for page layout, and not HTML tables, as still done by some major shopping carts. The pages are built using templates, making it easier for developers and third-party vendors to create custom themes for the pages (known as "skins"). Version 3.0 offers product listings, options, categories, and images, including an image gallery. It also offers customer shopping cart functionality, order history, email and print invoicing, multiple currencies, popular shipping and payment options, email marketing, support for digital products, tell-a-friend links, product search, prebuilt skins, site documents, and a straightforward administrative panel, which I will explore later in this tutorial.
In this tutorial, I will consider the different versions available, and their licensing options, as well as how to install and configure it.
To run CubeCart, you will need several components: a Web server, a MySQL database, the PHP scripting language, and either Zend Optimizer or ionCube PHP Encoder, for decoding protected files. All of these components should be installed and verified to work, before installing CubeCart itself. Most competent Web hosting services provide all of these needed components.
For this tutorial, I will be utilizing Apache version 2.2.8, MySQL 5.0, and PHP 5.2.5. But CubeCart will work fine with many of the earlier versions of these components. If you are setting up a development environment on a Windows server, then detailed information can be found at DeveloperTutorials.com, with instructions on how to install and configure Apache, MySQL, and PHP.
Choosing and Downloading CubeCart
On the CubeCart home page, you will see that two major versions are currently available, version 3 and the recently released version 4.
The former version is completely free as long as you leave the company's copyright notice on your site's pages. The notice can be removed by purchasing a copyright removal key for a one-time fee of $89.95. The latest version has the same pricing, except the software license is no longer free, but instead $129.95. There is a 30-day free trial if you would like to test that version risk-free. (All product information is as of this writing, and could change in the future.)
Even though version 4 of CubeCart adds many new features, this tutorial will focus on version 3, because that is the one most commonly used at this time, and thus most thoroughly tested by the vendor and by users worldwide. In addition, there are far more modules written and tested for version 3.
Your first step in installing CubeCart is to go to the version 3 download page.
Click the link for version 3.0.17, which is what I will be using in this tutorial. This will take you to the 3.0.17 page, which has more detailed information about this particular maintenance release.
Click the Download button, and save the archive file (CubeCart_3.0.17.zip) somewhere on your computer. If you have a broadband connection to the Internet, then the download process should take just a few seconds, because the installation file is only 2.5 megabytes in size. (Before leaving that download page, you may notice that the total number of downloads so far exceeds 200,000. For version 3.0.15, the figure is greater than 7 million! This gives you an idea as to CubeCart's popularity.)
Open up the archive file, and save the contents of the "upload" directory into a new CubeCart directory within your Web server's root. The entire CubeCart installation on disk comprises 1125 files in 236 directories.
Next create a database on your MySQL server for CubeCart. The following commands will do this:
CREATE DATABASE cubecart_test; GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, INDEX, ALTER, CREATE TEMPORARY TABLES, LOCK TABLES ON cubecart_test.* TO cubecart_user@localhost IDENTIFIED BY 'password;
Note that I am using test values only, and you should use a far more secure password for any production installation.
Point your Web browser to the CubeCart index.php, which will begin CubeCart's installation process. For instance, if you had named the CubeCart root directory "CubeCart/" and had placed it in the root directory of your local Web server, then the URL to use would be "http://localhost/CubeCart/index.php". You can even leave off the "index.php" if your Web server has been configured to look for that file name as a default.
At the license agreement page, click the agreement checkbox and then the Continue button.
At the second screen, verify that all of the file permissions are set correctly. This applies only to Linux and Unix servers, as seen in the screenshot above, in which a Windows XP server is being used.
The third screen, shown above, is a critical one, because this is where you will enter the information needed by CubeCart to connect to the database you had created earlier. You should also set your country location and your administrative login information. CubeCart version 3.x comes preloaded with three skins: Classic, Legend, and Killer. In this tutorial, I will use the first option, which is the default. You can click on any of the three thumbnails to see a larger image of each skin. Most likely, none of the advanced settings need to be changed.
At this point you can breathe a sigh of relief, because you are now past the stage of the installation process that gives beginners the most difficulties. If you are installing on a Linux or Unix server, you are now prompted to change the permissions of the configuration file includes/global.inc.php, making it not writable by others, for security reasons. Again, for Windows users, this is not applicable. (However, it does not stop the admin panel of CubeCart version 3.0.16 from complaining that your configuration file is still writable, whenever you log in as the administrator.)
You have now finished CubeCart's installation process.
Verifying Your Installation
If you now try to run CubeCart by going to the root directory of your store, you will receive the error message "WARNING - Your store will not function until the install directory and/or upgrade.php is deleted from the server." Delete or rename the directory "install", and then reload the page.
You should now see the initial CubeCart store home page, shown in the screenshot above. By default, the left-hand column contains boxes for categories, featured products, product information, currencies, and languages. The right-hand column shows the customer's current shopping basket, the most popular products, products on sale, and a newsletter subscription form. The central area has a welcome message and a product list, which initially only includes a test product.
Clicking on the "Test Category" link takes you to a page showing all of the products in that category — again, just a single one at this point.
To access the admin panel, simply append the word "admin" after the CubeCart root directory path. Continuing our example mentioned earlier, the URL would be http://localhost/CubeCart/admin/index.php
Login using the CubeCart administrator username and password that you specified in the third stage of the installation process.
The main section used for changing your store settings, is appropriately named "General Settings", and is found in the "Store Config" menu area in the left-hand column.
Do not be intimidated by the fairly large number of options on this page, because most of them will never need to be changed. However, you should customize all of the information in the "Meta Data" section at the top.
Confirm that the values in the "Locale Settings" section, near the bottom of the page, are correct. The other three menu items in the "Store Config" menu area can be used for: working with countries and the zones and states within them; tax rates that you wish applied to customers residing in those areas; and currencies that customers can view your products priced in, and at what foreign exchange rates.
Lastly, go to the "Site Documents" link in the "Documents" menu area in the left-hand column.
If and when you wish to deploy your CubeCart store on the Web, upload all of the contents of the CubeCart directory into the root directory of your remote server. Then export the CubeCart database on your local computer into an SQL file, and import that into your remote MySQL server. Next, modify the site settings within "includes/global.inc.php" if needed. Finally, test the CubeCart store as well as the admin panel, to verify that everything is working.
You now have a fully functioning online store, ready for products to be added.