Dr. Dobb's is part of the Informa Tech Division of Informa PLC

This site is operated by a business or businesses owned by Informa PLC and all copyright resides with them. Informa PLC's registered office is 5 Howick Place, London SW1P 1WG. Registered in England and Wales. Number 8860726.


Channels ▼
RSS

The OpenACS E-Commerce Solution


The OpenACS E-Commerce Solution

Rafael A. Calvo and Mark Aufflick

The Open Directory Project (http://www.dmoz.org/) lists more than 200 shopping cart/e-commerce software packages, and more than 20 of these are open source, including Red Hat's Interchange (formerly Minivend), and others familiar to the IT community. So why highlight the Open Architecture Community System (OpenACS) and its e-commerce package?

Simply put, it has a unique angle -- OpenACS was designed to create and maintain online communities (as its name indicates). The community features of OpenACS set it apart from other e-commerce packages. OpenACS community functionalities include calendars, discussion forums, content management, an advertising server, and more.

The OpenACS e-Commerce package provides a huge number of features "out of the box", including managing products, managing users and personalization, managing orders, providing customer service, and auditing and security. These features will be described later, but first we'll provide some background information.

The Open Architecture Community System

The OpenACS framework is based on the former ArsDigita Community System (ACS), which was developed to solve the problem of creating scalable Web community systems. ACS was first released under the GPL license in 1997 by Philip Greenspun (and others), in an attempt to achieve software reuse across a number of community Web-site developments with similar business requirements and use cases. ArsDigita Corporation developed and maintained ACS-based Web sites for commercial customers and kept ACS open source. These customers included Oracle, Siemens, Levi's, MIT's Sloan School of Management, and the World Bank. In 2002, ArsDigita was purchased by Red Hat.

The initial ACS platform was implemented on the AOLserver Web server using the Tcl programming language and the Oracle RDBMS. At this same time, the OpenACS project was commenced by a number of developers seeking to implement a version of ACS that would run on an open source RDBMS.

By 2000, ArsDigita was in a stage of rapid growth and during 2001 changed its strategy to focus on a new application framework fully developed in Java. With this change, OpenACS became the official code base for the Tcl-based ACS system. Today, OpenACS is a mature project in its own right, with more than 5000 members and at least 10 companies that provide commercial support and development. The most recent version, OpenACS 4.6, will have been released by the time of printing.

The framework is being used for large and small sites by a number of organizations including Greenpeace and MIT's Sloan School of Management. As already mentioned, OpenACS is not dependent on any particular RDBMS, and today it runs on either Oracle or PostgreSQL, with the ability to support other ACID-compliant databases if necessary. The architecture stores the queries in XML files that are read at start-up, so different RDBMS have different sets of XML files.

Figure 1 shows the OpenACS architecture. The core packages are those required for OACS to function, which includes a kernel, package management, administration utilities (users, sitemap, and other common business objects), a template system that cleanly separates business logic from presentation, and a backend mail and messaging system. Services such as the events package are implementations of reusable logic that is not application dependent and does not require a user interface. Application packages have a user interface and their code is clearly divided into application and presentation logic. This presentation logic can be neatly implemented in adp (Tcl scripts embedded in HTML) using the template system, which also provides simple control structures that designers can customize.

Each service and application requires a data model that will be integrated into the framework. The integration of these data models enables reusability and a number of functionalities. To increase reusability, the framework has an object-oriented architecture but, because the RDBMS does not implement OO functionalities, they must be added ad hoc by the framework. The OpenACS objects have their attributes stored in tables and a set of methods defined as PL/SQL packages. These packages hold the procedures that make the programming interface for the data model.

The idea behind the OO architecture of OpenACS is that each piece of information that might be reusable should be an object. Since RDBMS are inherently not OO, data structures are integrated into the framework by being added to an acs_objects table that keeps track of every OpenACS object. Another table, called acs_object, defines the standard attributes stored on every object, including a system-wide unique ID, an object type, and auditing columns. The concept of OpenACS object types is equivalent to classes in OO programming languages; because we are using a RDBMS, additional work must be performed. However, if you are just going to use one of the OpenACS applications, such as the e-commerce module, you do not need to go into these internal details.

OpenACS E-Commerce Module

The OpenACS e-commerce package was originally developed by Eve Andersson at ArsDigita, and then ported from ACS to OpenACS by Jerry Asher, Walter McGinnis, and furfly.net, and more recently extended by Bart Teeuwisse. Much of this article is based on their extensive documentation.

We will first look at installing OpenACS and its e-commerce package. Then we will explore using its features.

Installing OpenACS

OpenACS requires either PostgreSQL (7.1 for OpenACS v4.5, 7.2 for v4.6) or Oracle 8i. This article assumes that you are using PostgreSQL, and that it is already installed (available from http://www.postgresql.org). AOLServer requires libxml2 and associated headers (look for packages like libxml2 and libxml2-devel in your package manager, or compile the sources from http://xmlsoft.org).

Special requirements of the e-commerce package are ImageMagick (if you want to have thumbnail images automatically made of your product photos), and qmail (if you want to use the customer service module). Both of these are available in the package manager of most major *nix distributions, or are easily compiled from source.

It is recommended that you create a user and group for the AOL server. You can accomplish this on most systems with the commands:

$ su (enter your root password when prompted)
$ groupadd nsadmin
$ useradd -m -g nsadmin nsadmin
$ exit
If you have compiled PostgreSQL yourself, it pays to be sure that the psql programs and libraries are in your execution and linking path. Before we go any further, we want to su nsadmin so all our AOLServer compilation is done by the unprivileged user we just created. The AOL server software must be compiled, which is easy on most platforms. On other platforms, such as Mac OS X, it will take some work. Download the source for "AOLserver 3.3ad13" from http://openacs.org/software.adp, where the ad13 suffix indicates the version of ArsDigita patches and database drivers included with AOLServer 3.3. The packaged AOLServer 3.4.2 for ACS sources is available at: http://uptime.openacs.org/aolserver-openacs/. The standard OpenACS configuration assumes that you have your Web sites installed under /web, so we will create it in the following command listing. We also need to create database permissions for our nsadmin user (the postgresSQL user on your system may have a different name):
$ su
Password: (enter your root password)
$ mkdir /web
$ chown nsadmin.nsadmin /web
$ su -c postgres createuser nsadmin
Shall the new user be allowed to create databases? (y/n) y
Shall the new user be allowed to create more new users? (y/n)
n
CREATE USER
$ exit
Next, download the latest release of OpenACS (version 4.6). It is available as a tarball from http://openacs.org/software.adp, but we will download the latest version including bugfixes from the cvs server:
$ su nsadmin
Password: (enter your nsadmin password)
$ cd /web
$ cvs -d :pserver:[email protected]:/cvsroot login
(Logging in to [email protected])
CVS password: (hit enter here for a blank password)
$ cvs -z3 -d :pserver:[email protected]:/cvsroot \
  checkout -r oacs-4-6 -d openacs-4-6 openacs-4
Now for the AOLserver config file -- most of the work has been done for us, so download the template from: http://openacs.org/doc/openacs-4/files/openacs4.tcl.txt and save it to /tmp from your browser. Then relocate, rename, and edit it:
mv /tmp/openacs4.tcl.txt ~nsadmin/mystore.tcl
vi ~nsadmin/mystore.tcl
Listing 1 explains the core configuration options that should be all you ever need to modify. Much of the rest of the configuration file is self-explanatory, and is well documented on aolserver.com. We also need to name the site directory and create the database to match the name we gave it in the configuration file:
$ cd /web
$ mv openacs-4-6 mystore
$ createdb mystore
CREATE DATABASE
$ createlang pgplsql mystore
Now we are ready to start our server for the bootstrap process. To begin, start the server in a terminal window:
$ cd ~nsadmin
$ su -c ./bin/nsd -u nsadmin -g nsadmin -ft ./mystore.tcl
Password: (enter your root password)
Notice: nsd.tcl: starting to read config file...
Warning: nsd.tcl: nsssl not loaded because key/cert files do
not exist.
Notice: nsd.tcl: finished reading config file.
...
Notice: nssock: listening on 0.0.0.0:80
Notice: nssock: starting
Notice: nssock: accepting connections
You will see a lot more notices and warnings on the screen. The nssl warnings are normal if you don't have valid ssl certificates. AOLserver needs to start as root only to take control of port 80. As soon as this is done, the process switches over to running as the unprivileged user nsadmin, per standard security procedures. The -t option specifies the configuration file. The -f option specifies to run in the foreground for debugging purposes. Normally these messages are saved to the log files in /home/nsadmin/log. Open a Web browser and enter your site address. You will see the screens shown below as well as some others, and it is simply a matter of following the prompts. When the bootstrap loader says it may take some time -- it means it! There are about 300 sql files to be loaded into the database, among other things. At the end of the process, the server will exit ready to be restarted. Now is a good time to configure your server to start up automatically at boot time. Everyone seems to have their own favorite way, but if you want some assistance, check out your *nix distribution documentation. There are also some good pointers at http://www.openacs.org/doc/. However you start it, run the following command as root:
/home/nsadmin/bin/nsd -u nsadmin -g nsadmin \
   -t /home/nsadmin/mystore.tcl
The server will automatically switch into the background. After giving your server a minute or so to start up. Look for the line saying "accepting connections" in the log file; in our case, that is /home/nsadmin/log/mystore-error.log. The standard front page shown in Figure 2 will greet you. We are ready to install and mount the e-commerce package, so log in using the details you provided at install time, and click the "Package Manager" Link.

Installing and mounting a package in OpenACS is as easy as clicking a few buttons in your browser. Click on the "Install Packages" link and wait for the available package list to load. Unless you really want to load all of the packages, click the "uncheck all" link, and select the following packages: ACS Reference Data, Reference Data - Country, Reference Data - Language, Reference Data - US States, E-Commerce. Click "Next", and then click "Next" on the following screen to load the packages.

After installing packages, you must restart the AOLserver process. How you do this will depend on the way you set up your server to start, so consult your documentation. Return to the home page, and this time click on the "Site Map" link. The site map is where you lay out your OpenACS site. You can create directories and then mount any of your installed applications on those directories. Most packages can be mounted multiple times and will operate as independent applications.

Next to the root URL (/), click "new sub folder". Name the subfolder "ecomm" and click the button. You will now see an empty ecomm folder in your site map; click the "New Application" link next to it, and then select "E-Commerce" from the list. The name you allocate here isn't important, except it helps you identify your applications if you have many of them. We are now ready to configure our e-Commerce application.

Installing OpenACS E-Commerce

The process for applying for a merchant account is specific to the processing gateway chosen, and is documented in the package documentation, which is now available on your site (e.g., http://www.mystore.com/doc/). While still in the site map, you will notice some links next to your newly mounted application. "Set permissions" allows you to customize the default security setup, but for now, click on "set parameters" to configure the core elements of our e-commerce site.

The parameters page is broken into a number of self-explanatory sections, accessed by clicking the links near the top of the page. This setup covers basic issues such as currency, which features you want to enable, whether to allow pre-ordering, etc. As soon as these pages are submitted, your changes will be active. The only parameter that you need to take care of immediately is the EcommerceDataDirectory and the ProductDataDirectory, where files for each product can be uploaded. You will also need to create the directories in the file system.

Similarly, there are simple Web pages for the following configuration areas:

Products -- /ecomm/admin/products

Shipping cost rules -- /ecomm/admin/shipping-costs

Sales tax rules -- /ecomm/admin/sales-tax

User classes -- /ecomm/admin/user-classes

Email templates -- /ecomm/admin/email-templates

Figure 3 shows the main administration page. Be sure to read the help for both shipping cost rules and sales tax rules, because they are quite flexible.

Customizing OpenACS E-Commerce

If you are happy with the (rather bland) default templates, you will now have a fully functioning e-commerce Web site! You can see how it would look in Figure 4.

Thankfully, the templates are easy to customize. The e-commerce package allows you to define different templates for different things (e.g., different product types). There is a basic ui for submitting these templates in the /ecomm/admin/products admin Web page. These, and all other templates, are AOLserver templates with the extension ".adp" and they are a simple extension of the HTML tagset. Web designers will have no trouble learning the simple variable substitution and additional tags such as <if @variable@ true></if>. Full documentation of these additional tags is on your server at the URL http://mystore.com/doc/acs-templating.

Assuming you have followed the standard install, you will find all of the non-product template .adp files on your computer's file system at /web/mystore/packages/ecommerce/www/. You must edit the email templates that are used to automatically send messages, such as order confirmations, to customers. You can do this at the URL listed above.

Using OpenACS E-Commerce

Managing products

Producing and maintaining a large-scale product catalogue is a difficult task, and this is, perhaps, where most e-commerce packages fail. Once OpenACS is installed, it is easy to create categories and start adding products. Click the "Add" link on the products admin page and fill in the details.

If you get an error page mentioning a problem creating a directory called /web/yourservername/data/ecommerce/product/, then you missed setting or creating the data directory when you were following the instructions in the site map "set parameters" section. Go to /admin/site-map and click on the "set parameters" link next to the e-commerce package. Click on the "ALL" link up the top, and find the parameter for the data directory. Be sure this directory is set to where you want your products to be stored, and be sure it exists (if not, create it).

By "managing products", we mean the information that relates to them and is shown to your customers in the catalog. You can, for example, batch upload a .csv file of products. The format required for this file can be found in the package documentation already mentioned.

The package has flexible "storage" capabilities that allow you to upload files (e.g., chapters of books) that complement product descriptions. Also, each product can have a "reviews" section and ratings tool, so users can share information.

Since OpenACS was developed for building communities, and an important key to online communities is personalization, it's no surprise that OpenACS offers many great features in this area. For example, you can define rules regarding how to display products (or whether to display them at all) depending on who the user is. In addition, different pricing schemes can be set for individual products. This is useful when you want to have a limited-time sales price, which is given only to those who have the special offer code in their URL, or to users that fall into some particular profile.

Cross-advertising is when you link between products. In OpenACS, the site administrator can specify that one product always links to another product. Product categorization can be set up at /commerce/admin/cat/. For some shops, complex categorization is unnecessary, so product categories, subcategories, and sub-subcategories are optional. However, we believe that for some shops, three levels is limited, and that the catalog data model should be able to handle longer trees (unlimited category levels). There is already work being done on a new catalog engine that should be included in the next version.

Managing Users, Templates, and Personalization

As mentioned, the power of OpenACS is in managing communities of users and personalizing their experiences, which is done by having a common data model, and a standard way of storing information in the RDBMS. This is perfect when you are using or integrating OpenACS applications, but it can get a bit tricky when you write something from scratch. In these cases, the developer documentation and the online community behind the project are indispensable.

After users log in, they can be tracked around the site, and thus grouped into different "market segments" (user groups). The user profile can be built on different sources (e.g., browsing or buying history). With a bit of programming, you could even build profiles on a user's activity in another OpenACS application, like discussion forums or calendars. To set up user classes, you simply go to /commerce/admin/user-classes and the package will guide you. Here you can create groups such as "student", "military", etc., that get special prices, different views of the site, or different product recommendations.

Some countries have more strict laws about the type of information you can keep about your customers, so you may need to make information visible to your users. This can be done by changing your settings in the server's start-up file, so that users can see the user classes to which they belong.

The system has some default rules to handle classes. For example, if a user is a member of more than one class and there are special prices on the same product for both classes, the user will receive the lowest price. Other features include mailing lists and "top 10" lists.

Managing Orders

Checking out in OpenACS is similar to other checkouts. Users can suspend orders, receive email alerts, buy and collect gift certificates, get refunds, and check order history and status.

Providing Customer Service

One of the outstanding features of the E-Commerce package is the customer service module. All customer issues and interactions can be logged and categorized to allow reporting and management by different areas of your company. All email correspondence with the customer is automatically logged in the interaction history. Email correspondence is also made easier and more consistent with a "canned" email system that provides templates for your customer service staff to modify and send.

Bulk emails can also be sent to customers based on many interesting criteria such as products they have purchased, products they have looked at, etc. Your emails are even sent through a spell checker.

If you want to see a great site that uses OpenACS, visit Berklee College of Music (http://www.berkleemusic.com/). They are using openACS for their content management, for e-learning, and of course for commerce. The shopping cart is used here to sell physical products (CDS and books), as well as virtual ones (courses).

Resources

OpenACS official site: http://www.openacs.org

Web Engineering Group: http://www.weg.ee.usyd.edu.au

Furfly.net consulting: http://www.furfly.net

Berklee College of Music: http://www.berkleemusic.com/

Rafael Calvo is a lecturer and course developer in E-commerce at the University of Sydney. He has taught at several universities, high schools, and professional training institutions. He has worked at Carnegie Mellon University (USA) and Universidad Nacional de Rosario (Argentina). Rafael has managed projects and worked as an Internet consultant for projects in Australia, Brazil, USA, and Argentina. He has a PhD in Artificial Intelligence applied to automatic document classification (e.g., Web site classification). He can be contacted at: [email protected].

Mark Aufflick is a freelance developer and consultant, specializing in Web-based workflow and document systems. He has worked with Australian universities, publishing companies, and financial organizations. Mark was previously employed as an infrastructure technology specialist for a leading global management consulting firm working in Australia, Asia, Europe, and the USA. He has a bachelor's degree in Computer Science from The University of Melbourne. He can be contacted at: [email protected].


Related Reading


More Insights






Currently we allow the following HTML tags in comments:

Single tags

These tags can be used alone and don't need an ending tag.

<br> Defines a single line break

<hr> Defines a horizontal line

Matching tags

These require an ending tag - e.g. <i>italic text</i>

<a> Defines an anchor

<b> Defines bold text

<big> Defines big text

<blockquote> Defines a long quotation

<caption> Defines a table caption

<cite> Defines a citation

<code> Defines computer code text

<em> Defines emphasized text

<fieldset> Defines a border around elements in a form

<h1> This is heading 1

<h2> This is heading 2

<h3> This is heading 3

<h4> This is heading 4

<h5> This is heading 5

<h6> This is heading 6

<i> Defines italic text

<p> Defines a paragraph

<pre> Defines preformatted text

<q> Defines a short quotation

<samp> Defines sample computer code text

<small> Defines small text

<span> Defines a section in a document

<s> Defines strikethrough text

<strike> Defines strikethrough text

<strong> Defines strong text

<sub> Defines subscripted text

<sup> Defines superscripted text

<u> Defines underlined text

Dr. Dobb's encourages readers to engage in spirited, healthy debate, including taking us to task. However, Dr. Dobb's moderates all comments posted to our site, and reserves the right to modify or remove any content that it determines to be derogatory, offensive, inflammatory, vulgar, irrelevant/off-topic, racist or obvious marketing or spam. Dr. Dobb's further reserves the right to disable the profile of any commenter participating in said activities.

 
Disqus Tips To upload an avatar photo, first complete your Disqus profile. | View the list of supported HTML tags you can use to style comments. | Please read our commenting policy.