...making Linux just a little more fun!

<-- prev | next -->

closedShop - The Open Source Shopping Cart

By Chris Fleizach

I ran across this piece of software while searching for an Open Source alternative to the commercial "shopping cart" software (which was mostly poorly written, and in a number of cases, badly broken.) Chris's approach impressed me with its simplicity, utility, and ease of installation - and fit my requirements perfectly.

One of the arguments that the opponents of Linux use, over and over, is that "Linux doesn't support business". IBM, Novell, Oracle, SAP, and countless other companies have been proving them wrong in the corporate world; by soliciting articles from authors of software that caters to the small and mid-sized business, such as Chris Fleizach's closedShop, I hope to cut the feet from under this part of their argument as well.
-- Ben


About three years ago I was faced with the challenge of putting together an e-commerce site that would not require online credit card processing. Although I searched briefly, I only found expensive solutions. Thus I began work on closedShop, an open source shopping cart. Over the past three years, there have been over 13,000 downloads spread across 9 releases. Basically, closedShop is a free shopping cart written in Perl, using the mySQL database as a back-end, that allows anyone to set up shop with no online credit card processing necessary. They can process the credit cards manually, as most businesses already have a manual credit card processor.

Before we go into a tutorial on how to set it up and start accepting orders, it's good to know what closedShop offers:

If that's what you need, then closedShop is a pretty good solution for you. The first thing you need to do is download the latest version from SourceForge.

After downloading, unzip the contents into your cgi-bin directory. Make sure the all the files have 755 permissions (closedShop doesn't work very well on Windows-based servers, only *nix types). Most FTP programs allow you to change permissions (via the 'chmod' command). You'll want to make all the files read-write-execute for the owner, read-execute for the group, and read-execute for everyone else. This set of permissions is also known as 755.

You also need to make sure that the web server is allowed to write to the directory that closedShop is saved in. This is very important since the program needs to save some data in flat-text files. Most web hosting services allow this automatically. If your server does not allow it, closedShop will tell you so and will not attempt the installation. If you see this message you may need to contact your hosting service and tell them you'd like to allow the web server to write to the directory that closedShop is in (usually the cgi-bin directory.)

[ Previously, Chris' article got sidelined due to the security concerns with the instructions in the above paragraph during our technical review; making "cgi-bin" world-writeable is not usually adviseable. However, I eventually decided that it wasn't all that insecure in the first place (someone would have to crack the webserver to get access), and that a simple modification of closedShop would get rid of the above requirement in any case. Open Source in action, at your service. :) -- Ben ]

Assuming you have passed that main hurdle, you will now go to your web browser and access the file called Install.pl. If you put closedShop in your cgi-bin directory (and assuming your site is located at "www.yoursite.com"), then to access Install.pl, you'd type

https://www.yoursite.com/cgi-bin/Install.pl

A web page will come up and ask you to enter some important information. Some of it will be about your company, some about taxes, some about how you would like your tables to appear. For most of the data you can leave the default. The most important information is about the mySQL database. You must have access to a mySQL database before installation. Most web hosting services allow this access, but you may need to request it beforehand. Then they will send you a mySQL username/password and database name. You put this information into the mySQL database section.

The other important section is the admin password and merchant password. The admin user will allow you to make all changes to the program, while the merchant account shows fewer administrative changes and is more for processing orders. It allows two people to log on at the same time as well. Remember those passwords, you will need them to log in.

After you fill out the rest of the data, click 'Install' and it will take about 30 seconds to prepare everything. Afterwards, you'll see a screen that says go to the Admin.pl script. There are four scripts that do the different functions. Admin.pl handles administrative tasks. Cart.pl is for the shopping cart and checkout procedures. User.pl is for individual clients to login and watch the order tracking as well as manage their wish list. Item.pl displays items and categories and also allows for searching.

Once you log into Admin.pl you will see the different options. You may want to edit category information first for the categories you entered in the Install. Note: if you want to add more categories or change the name, then go to "Edit Program Variables". Other information about categories can be viewed as well in the "Edit Categories" section. After editing categories, you should start adding products, either through the "Add Product" option or through importing. When adding a product, you also have the option of posting the item to eBay at the same time. The eBay information will be below the main information and is not required.

Finally, you need to integrate closedShop into your site. You'll find important links under the "View Important Links" option. This tells you the URLs for each category, Searching, User logon and the Shopping Cart. If you have a standard design for your site you can allow closedShop to use that design with the header and footer variables in the "Edit Program Variables". The header is a file that contains the top part of the HTML for your design. The footer is a file that will contains the bottom part of the HTML for your design. closedShop will insert itself into the middle. These files could be made and put in the cgi-bin directory. Normally, you would name them header.html and footer.html and put those respective values into your program variables.

You should then take the links you want to use, like Searching, and link them into your design. An example of this can be found at Demo Site on the closedShop web site (https://closedshop.sourceforge.net)

Of course, you should also use SSL if possible. Customers will be entering their credit cards over the site and you will be viewing them. If you're not using SSL capabilities then there is a greater possibility of having the data stolen. Most web hosting services allow customers to use their SSL certificates and SSL processing. It may be a different link than what you are used to seeing, though, something that looks like it is from the hosting service. In this case, you'll want to change the program variables and change the names of the files to use the https:// and then type in the full URL to the secure location. You'll also need to change the image directory URL to the secure path, otherwise users may get messages complaining about a mixture of secure and non-secure. You should always access the Admin.pl script using the secure connection, otherwise you leave yourself vulnerable to thieves.

The program has been designed to be as straight-forward as possible. If you go to each script, you will see the default screen appear initially. There is also more information in the documentation that comes with each release. Of particular interest might be the template features, which allow you to mix in Perl programming with your template in order to totally customize the look and feel of Item and categories.

If there are any questions, comments, concerns, or suggestions, they can always be directed to email.

 


[BIO] Chris is a Peace Corps volunteer in the Kingdom of Tonga and has been bringing them the world of Open Source for almost two years. He is also a founding member of FightLiteracy.com, the only organization in the world dedicated towards ending literacy.

Copyright © 2004, Chris Fleizach. Released under the Open Publication license unless otherwise noted in the body of the article. Linux Gazette is not produced, sponsored, or endorsed by its prior host, SSC, Inc.

Published in Issue 107 of Linux Gazette, October 2004

<-- prev | next -->
Tux