LJ Archive

MiniVend—the Electronic Shopping Cart

Kaare Rasmussen

Issue #62, June 1999

If you need a catalog system for your web page, this product may be just what you are looking for.

When managing an ISP, you will eventually need a solution for electronic commerce. Many possible solutions are available, but the problem is that they are either big and expensive or small freeware that does not include all the necessary options. I heard about a system called MiniVend, released under the GNU General Public, and decided to try it out.

Features

MiniVend is a full-featured electronic catalog system (commonly known as a shopping cart) with on-line ordering capability. It is designed to provide an interface complete with SSL security and full database support.

Some of the main features of MiniVend 3.0 are:

  • Multiple catalogs allow one server to run many shops, so it is ideal for an ISP.

  • Security is provided through SSL for credit card ordering and PGP for mailing of orders.

  • It has a well-developed database integration with SQL support, including ODBC.

  • A very powerful search capability is provided with fast binary search, range searching, numeric and alphanumeric search sorting with reverse, numeric and case-insensitive options, etc.

  • All aspects of the appearance can be controlled. MiniVend supports frames, and the pages can be built on the fly or pre-built for heavily used items.

  • It is very flexible, with sales tax, discount and freight calculation, easy price adjustments and much more.

  • Cookie support allows users to leave the shop and come back without losing session state. It works well with all browsers and includes CyberCash support.

  • Easy administration is possible with automated installation and configuration, and off-line and on-line database builds.

MiniVend is a client/server system. The browser talks with a small application that in turn talks with the MiniVend server through a socket. For this reason, you don't have to load the MiniVend server for each user session, which might overload the system.

Figure 1. The MiniVend System

I don't know how the name came to be—there is nothing “mini” about it. It is a full-featured electronic commerce system that can meet the needs most people have for such a system. MiniVend is powerful and correspondingly complex. It can easily scale from a few items per catalog to a million items or more, with excellent performance. If you have only a few items and don't intend to grow, MiniVend is probably overkill.

Requirements for Electronic Commerce

The key issues are ease of use and flexibility. The system should do what is needed without too much administrative work and also include all your desired features in an easy-to-use manner.

Options that are a must include:

  • The ability to exchange data between internal and external databases. The product information will normally be kept in a company database of some kind, and entering data by hand would be cumbersome, to say the least.

  • Automate the order process as much as possible. The ideal situation will be one where you only have to feed the order into your system, with all taxes, freight costs, etc. handled by the software.

  • A method of handling discounts for selected customers and for volume sales should be available.

  • Feedback should be sent to the customer by e-mail when an order is made. This helps to catch any errors made by the system or the customer.

  • Security for payments is also an issue. The system needs to use SSL and perhaps another encryption protocol when it sends data to and from the database.

  • Good documentation and support is needed. The documentation should be so well-written that it can get you started quickly (in a matter of hours); the support should get you past any show stopper.

We all have different needs, and each person will have a preference as to what goes into a system for electronic commerce. I like a system that does only what it is supposed to do: handle product information, searching and ordering, while leaving domain name registration and chat rooms to their own specialized tools.

Why I Chose MiniVend

Whenever I have a choice between commercial and Open Source products, I always try out the freeware first. Of course, there is the issue of price, which in the case of Shopping Carts can be a very big issue. Access to the source code will in most cases guarantee that the system is more error-free, because users can have a look at the code and suggest solutions to any existing problem. After all, the users are the people who know where the trouble is, and they are normally more motivated to find and correct it.

However, it is not only a choice between commercial and Open Source systems. Other Open Source products are available, but MiniVend stands out in the features category. It is simply incredible how much functionality is provided and how easy it is to configure. All the configuration options I could think of and more are included.

Also, MiniVend is easy to use with several merchants, and I can use it with my Apache 1.3 with no problems.

Installation

Installation couldn't be easier. Simply type

su wwwrun
tar xvzf minivend-latest.tar.gz

in the directory where you want the installation directory to be created. This command will unpack the latest version of MiniVend. The version I downloaded was 3.11, which was released only a week or so before I tried it. (See Resources.)

The user wwwrun owns the web server's /DocumentRoot directory. Any user with write access to both this and the /cgi-bin directory can be used.

./configure

The installation process includes a long question-and-answer session, but you can just press enter to answer most of the questions; MiniVend comes with sensible default values. When the installation of MiniVend is finished, you will get the opportunity to install a catalog:

-> /home/httpd/mvend
-> Make the simple demo now? [yes]
Select a short, mnemonic name for the catalog. This will be used to set the defaults for naming the catalog, executable and directory, so you will have to type in this name frequently. If you are doing the demo for the first time, you might use “simple”:
Catalog name? simple
The rest of the installation consists of some simple questions I won't repeat here. The server name and /cgi-bin location should be working before you try to install MiniVend.

Figure 2. The Simple Demo

When everything is installed and ready, you can start the MiniVend server with this command (use the path to your installation):

/home/httpd/mvend/bin/start

Installation Notes

MiniVend is a big program, meaning it is very complex, and if you encounter problems, support is not always available. A mailing list is available, but none of my questions got answered during the test period. That included questions about internationalization and the installation problem I had on the one machine on which it was needed.

On the other hand, I found the documentation to be very extensive, though a bit hard to follow at times. The 600KB HTML documentation (see Figure 3) is a definite plus.

Figure 3. MiniVend HTML Documentation

Be very careful with your choice of user for the MiniVend server. This user must have write access to both the /DocumentRoot and the /cgi-bin directory, as you will install a demo with both HTML pages and CGI-scripts. But don't make the mistake of running the MiniVend server and the web server as the same user --that is a security risk to avoid. The best solution in a production system is to create a new user to handle the MiniVend server.

It is the user's duty to ensure the security of sensitive data. You can set up MiniVend to leave the data anywhere on the server or send it by e-mail to the merchant, but you must consider how to encrypt the data. MiniVend supports PGP encryption, so there is a way to set up a secure data transfer.

During this short test period, I obviously didn't have time to test for “wear and tear”, but everything seems to be designed with ease of use in mind. The system tables, e.g., sales tax or freight values, are easy to adjust, and you can update the database off-line or on-line, as individual records or all in one swoop.

Configuration of Web Pages

There's a host of options for configuring web pages. MiniVend has a complete tag language with over 80 different functions. You can embed code in the pages and use conditional statements like [if ...] text [else] else-text [/else][/if], allowing for insertion of text or HTML code based on some computed choice.

All MiniVend commands are embedded in the pages within square brackets ([ ]). MiniVend preprocesses the pages before turning them over to the web server, replacing the commands with the values they represent. The most basic commands are the data tags that embed information from the database in the web page, but there are also commands for looping, inserting text from external files, inserting total fields and a lot more.

Figure 4. Example of a Configured Page

The example in Figure 4 was done with an external file holding all the text of the page. I named a field “webpage” and put it in the database, then inserted this in the template for the product page:

[include pages/products/[item-field webpage]]

which means I want to include a file at this point in the web page. The file should be found in the directory /pages/products/ and have the name that is taken from the web page field of that product.

As a developer, I was happy to learn you can even embed Perl code into the pages. At the same time, I have to agree with the documentation; it is a feature to be used rarely. Embedding Perl is like using a chain saw: you can get the job done quickly, but if used wrong, it can cost you an arm and a leg!

Administration

At the heart of MiniVend is the Products database. Normally, it is just an ASCII file with fields separated by tabs. The field names are given in the first row and MiniVend indexes the database with GDBM (GNU Database Manager) automatically. You can even hook up to a real SQL database through Perl's unique DBI interface, if you already have one.

You can update the database on the command line with the offline command, or if you just want to change one record, you can use the update command.

It is possible to import data from any source, provided the data can be formatted with the fields separated by tabs. If you want to adjust all the prices in the system, it is easy to do so with the commonadjust feature.

MiniVend records all sessions for future use. Obviously, some session data will become obsolete after a while, so it is a good idea to put an expire script in your crontab file:

44 4 * * * /home/httpd/mvend/bin/expireall -r

This will prevent your session databases from growing too large.

Conclusion

MiniVend is very impressive, almost awesome. This is software of a kind that other companies ask thousands of dollars (or euros) for, and MiniVend is free through the GPL. It is also a showpiece, demonstrating the versatility of Perl. A shopping cart system is not a small piece of code; MiniVend is a full-featured, powerful example.

MiniVend is a big system, not something you can cover in one session. It has scores of features I didn't even have time to try out yet. I've had a few problems with it, but I firmly believe that MiniVend is a system that can be used for any kind of electronic commerce. As I learn the features and study the code, I will become more familiar with it and can make it do all the things I want it to do.

If you're looking for a turn-key system, MiniVend is not it. On the other hand, if you are looking for a powerful, flexible and easy-to-use system, MiniVend is for you. The documentation is great, the source code is all there and if the support on the mailing list scales up a bit, there is nothing to fear.

Resources

Requirements

Kaare Rasmussen (kar@webline.dk) is a software engineer and developer, responsible for the software direction of a small Danish ISP known as Webline when work, family and other duties allow the time. Kaare has been working with almost all aspects of the IT industry for the last twenty years or so. He has written several books in Danish during the past five years—the latest one about using the Intranet with Linux.

LJ Archive