Documentation for Yams 0.6.2

  1. About
  2. Obtaining
  3. Requirements
  4. Installing
  5. Upgrading
  6. Mailing List
  7. Configuring
  8. Shopping
  9. About Search
  10. Administering
  11. Sites using Yams
  12. Bugs, Patches, Comments
  13. Future Plans
  14. Changes
  15. Credits


About Yams

Yams (Yet Another Merchant System) is an e-commerce system. It provides tools for both the shopper and the administrator. Yams is written in Perl and utilizes a MySQL database on the backend.

Features include:

It features a persistent shopping cart, the ability to handle different types of products including various kinds of physical and electronic products as well as the ability to showcase "affiliate" products in your store but still allow the user to buy directly from the affiliate.

Yams is released under the the GNU General Public License.


Obtaining Yams

The latest version Yams is always available from the
Yams website at SourceForge.

Yams Requirements


Installing Yams

Preparing the database

The file tables.sql contains all the defintions needed to create the databases and tables used in the system. The user registration information is in the http_auth database and everything else is in the commerce database.

Two accounts need to be created, one for the http_auth database and one for the commerce database.

The tables can be created via the command line: mysql < tables.sql with all the necessary flags and arguments to mysql for logging in as the correct user.

Installing the code

The Yams distribution contains three directories: modules, scripts, and html. The modules directory contains all the code used in Yams. If possible, the recommended place to install the Yams subfolder is in the site_perl/version_number directory. If this is not possible you will need to add a "use lib '/path/to/yams/directory';" to all the .pm and .pl files.

The "commerce" directory inside of scripts should go inside of your cgi-bin directory or directory containing scripts to be run as Apache::Registry scripts. The "commerce" directory inside of the html directory should go into your htdocs directory structure.

Preparing the Web Server

Apache requires mod_auth to be compiled into if you wish to use the user registration system. The mod_perl module must be compiled into Apache if you wish to run Yams as Apacha::Registry scripts. If Yams is going to be run as normal CGI scripts then mod_cgi must be compiled into Apache.

If running under Apache::Registry, all the modules should be preloaded and initial database connections should be opened in the perl-startup.pl file. The additional code is provided in the perl-startup-add.pl file included with the distribution.

More Information

If you having trouble with any of the programs listed above, the following web sites may provide some help:
Apache, mod_perl, Perl, and MySQL.

Upgrading

From 0.6.1 to 0.6.2

No database changes are needed.

Running create_pds_table.pl in the script/utilities directory will populate the
tables used for the product description search.

Yams/Cart.pm, shop/toplevel.pl, and shop/cart.pl were updated.

From 0.6.0 to 0.6.1

The following tables need to be added to the database

CREATE TABLE product_description_search (
        sku varchar(15) NOT NULL,
        descriptions BLOB,
        PRIMARY KEY(sku));

CREATE TABLE related_product_data (
        id integer NOT NULL DEFAULT 0 AUTO_INCREMENT,
        sku varchar(15) NOT NULL,
        related_sku varchar(15) NOT NULL,
        PRIMARY KEY(id));
Be sure to use the updated shop/index.html and shop/cart.pl.

From 0.5.7 to 0.6.0

CREATE TABLE session_ids (
	session_id VARCHAR(24) NOT NULL,
	shopping_cart_number INTEGER,
        host_reference VARCHAR(50),
        string_reference VARCHAR(30),
	url_reference VARCHAR(100),
        date DATETIME,
        PRIMARY KEY(session_id));

ALTER TABLE orders ADD host_reference VARCHAR(50) NOT NULL DEFAULT '/', 
	ADD string_reference VARCHAR(30);

Also, be sure to update shop/order.pl, shop/address.pl, and admin/reports.pl.

From 0.5.6 to 0.5.7

No database changes are needed for this upgrade. Address.pm, Order.pm and address.pl are the files that needed to be upgraded to the latest version to close the security hole.

From 0.5.5 to 0.5.6

To upgrade from 0.5.5 to 0.5.6 the following database modification needs to be made:

ALTER TABLE download_product_data ADD COLUMN duration INTEGER NOT NULL;

From v0.5.1/0.5.2 to 0.5.5

To upgrade from Yams 0.5.1/0.5.2 to Yams 0.5.5 the following table alterations must be made.
ALTER TABLE orders MODIFY order_status 
	ENUM ('NEW', 'ASSEMBLING', 'PENDING CHARGE', 
                           'FULL SHIPMENT', 'PARTIAL SHIPMENT', 
                           'NO SHIPMENT', 'CANCELED') NOT NULL;
ALTER TABLE order_status_history
	MODIFY order_status ENUM ('NEW', 'ASSEMBLING', 'PENDING CHARGE', 
                           'FULL SHIPMENT', 'PARTIAL SHIPMENT', 
                           'NO SHIPMENT', 'CANCELED') NOT NULL;
ALTER TABLE order_status_history DROP PRIMARY KEY;
ALTER TABLE order_status_history ADD id integer NOT NULL DEFAULT 0 
	AUTO_INCREMENT, ADD PRIMARY KEY(id);
ALTER TABLE order_status_history DROP comments;
ALTER TABLE orders ADD comments BLOB NOT NULL;
ALTER TABLE products ADD COLUMN inventory_comments BLOB;
ALTER TABLE subscriptions ADD expired CHAR(1) NOT NULL DEFAULT 'N';
CREATE TABLE bundle_product_data (
	id integer NOT NULL DEFAULT 0 AUTO_INCREMENT,
	bundle_sku varchar(15) NOT NULL,
	item_sku varchar(15) NOT NULL,
	PRIMARY KEY(id));

From v0.5.0 to v0.5.1/0.5.2

To upgrade from Yams 0.5.0 to Yams 0.5.1/0.5.2 the following table alterations must be made.
ALTER TABLE orders ADD shipping_vendor VARCHAR(12) NOT NULL;
ALTER TABLE orders ADD tracking_number VARCHAR(34) NOT NULL;
ALTER TABLE products ADD intl_shipping_cost DECIMAL(8,2) NOT NULL;

Mailing Lists

There are a number of mailing lists for Yams, please see the
Yams website at SourceForge to subscribe.

Configuring Yams

The bulk of the code-level configuration will occur in CreditCard.pm, Shipping.pm, and Template.pm. Options can be turned on and off and high level configuration is done is YamsGlobals.pm

YamsGlobals.pm

YamsGlobals.pm is the configuration file for the system, it contains some meta-information about the store and allows various options to be toggled. The file itself contains descriptions of what each variable does.

CreditCard.pm

CreditCard.pm contains the code used to authorize credit cards. It contains one function "authorizeCreditCard." This is the function that decides whether the given credit card is accepted or not. If you are using Signio to do this then you should simply have to edit the user, password, and location variables at the top of the file. If you are using another vendor you will need to implement the function to do something similar for that vendor. Support for other vendors is planned for the future.

Template.pm

If you choose to wrap a templated header and footer around the dynamic content, then this module contains the suggested functions and variables that need to be set to allow the content to display correctly. This module was designed to allow us to template our pages, YMMV.

Future plans are to improve this templating mechanism. Below are descriptions of what the functions and variables in Template.pm are used for.

%departmentImages is a hash associating each department with a graphic to display to indicate which department the product list is for. This is only used internally in the module.

$top_navigation is internal and only used in the module. It defines the code to be used for the top navigation bar portion of the template.

&printBranding in internal and only used in the module. It prints a standard header/"branding bar" on each page that is dynamically generated.

&printTemplateHead is used to print out the generic header we use for a lot of the pages. The argument determine which header graphic should be displated above the dynamic content and below the navigation bar. This is called from other modules to display the template header.

$template_foot contains the code needed to close all the tables that are defined in the generic header. This variable is exported and should probably be wrapped in a function.

&printProductListHead is a slightly different version of the generic header. It adds in a graphic depicting which department the following product list is for. It is used when displaying a list of sub departments for a given department or for the list of products for each department. It is called from within the printProductList subroutine in Cart.pm

$product_list_foot closed what printProductListHead started.

&printProductForTemplateList prints out the product description to be part of the product list for a department. It is called from within printProductList in Cart.pm also.

&printTemplateProductDetail displays the long product description for a product in templated form.

&getAd is internal to the module and probably not useful to anyone else. It generated a random ad from a list to place into the branding bar. This is a quick fix until I figure out how to include a SSI in dynamic output.

&printSubProductListHead prints out yet another version of the header if we are trying to display a product list by subdepartments.

&printSubProductListHead prints out yet another version of the header if we are trying to display a product list by subdepartments.

&printAffiliateProductForTemplateList display an affilaite product within the product list framework. It allows you to place a link to the affiliate's site to purchase the item rather than sell it through your own channels. We are planning on using this feature to list books from Amazon; incorporating it into Yams allows us to dynamically generate those pages and hopefully make adding and subtracting books easier.

Shipping.pm

Shipping.pm currently contains code to deteremine the shipping by adding the shipping cost for each item or to calculate shipping by UPS ground commercial based on weight.

Future plans are to increase the number of possible calculations.


Shopping with Yams

This section gives an overview of the steps involved in a basic customer purchase.
  1. Customer visits front page of store.
  2. Customer chooses department.
  3. Customer is presented with a product list or a list of subdepartments to choose to from.
  4. Customer has three options for each item
    1. More info - this brings up a detailed product information page
    2. Add to Cart - this puts the item into the users cart
    3. Add to Cart and Login - this puts the item into the user's cart and prompts them to login or to create an account.
  5. If customer select "More Info" he then has the option to "Add to Cart" or "Add to Cart and Login."
  6. Once item is added to cart user can
    1. Adjust item quantities, 0 to remove. Electronic goods are limited to a quantity of 1.
    2. Place an order.
  7. Customer places order.
  8. If the customer has not yet logged in, he is prompted to login or create a new account.
  9. If the customer creates a new account and the option is one, the username and password will be mailed to the customer.
  10. Customer is then prompted for billing information. Customer also chooses where to ship the product: billing address, other address, multiples addresses.
  11. Customer is prompted to add/edit addresses and then choose where to send the order, or even the items on an item by item basis.
  12. Customer can also change the item quantities, or choose to save some of the items for later orders.
  13. Customer is presented with a preview of the order, with links to go back and change the billing information, shipping address, or quantities.
  14. Customer places order, is presented with a confirmation screen and receives a confirmation email.

About Search

It is possible to search for keywords in either the product's name or description. The current search is case insensitive and performs an AND on all search terms. It is currently present only in the front page of the store but can easily be incorporated into the template as it a simple form.

If you have an existing installation of yams, you can run scripts/utilities/create_pds_table.pl to populate the searching of descriptions.


Adminstering Yams

The following is a list of possible administration options.

Orders

Updating Orders

Clicking on the order number in any of the above reports will bring up that order for updating/editing.

At the top of the page is a list of the ordered items, the merchandise total, the sales tax, and the final total. For each item there is a popup menu for the item status and another for the order status. Then the customer's shipping and billing information as well as the results of the credit card verification are shown. The customer's username is printed if an e-good is part of the purchase. Next are the three values returned by the credit card processor. The first is the vendor's authorization number, and next are two advisory values about whether or not the zip code and address match the card. The last item on the order page is the status of the charge on the credit card.

Item Status Values

Order Status Values Charge Status Values Tracking Number
The tracking number consists of two fields. The first is a popup menu listing all possible shipping vendors. This list is defined in YamsGlobal.pm. The part is a text field for the entry of a tracking number.

Changes are made by using the "Update Order" button after the various stati have been adjusted appropriately.

Notes

If any of the auto add users flags is on, the new order will not have a status of NEW. The order will have a status of FULL SHIPMENT if the order only consisted of e-goods or a status of PARTIAL SHIPMENT if there were physical items invovled.

Departments

This section allows the administrater to create and modify the departments and subdepartments used to group the products for the customer.

Adding/Editing a Department

Click on the department name in the department list will allow the administrator to edit the values of the department. The addition form is the same as the edit form except that it is blank. There are only three pieces of information needed for a department: the "Department Name", a description of the department, and a status. The possible values for the status are ACTIVE and RETIRED. ACTIVE means that the customer can see the products in this department whereas RETIRED means that the customer can not see the products.

Adding/Editing a Department

The only difference between a subdepartment and a department is that the subdepartment form adds a Parent data item. This is the department that is the parent of the subdepartment.

Categories

Adding/Editing a Category

See "Adding/Editing a Department."

Affiliates

Adding/Editing an Affiliate

To edit an affiliate, click on its name in the affiliate listing. The data fields for an affiliate are:

Products

Adding/Editing a Product

Clicking on the product name in any of the listings iwll bring up a form to edit the product information.

Inventory

This section provides some basic inventory funcitonality. The link displays a list of all the products with a type of SHIPPED and the current inventory. The quantities can be changed by entering integers into the textfields and the quantity will be updated by that amount. Comments about each product can be entered here.

Subscriptions

Show Subscription Areas

This lists all the subscriptions that have been created. Clicking on its name will allow it be updated.

Add Subscriptions

This allows a new subscription to be defined.

Add User to Subscription Group

Allows an existing user to be added to a subscription group.

User Management

This section provides some basic user management tools.

See also MAM. for controlling access and managing web server users.

View Users

Editing Users

To edit a user, click on the username in either of the above listings.

Add a User


Sites Using Yams

The following sites are known to use Yams.

Bugs, Patches, Comments

I am interested in hearing and will make every effort possible to respond to bug reports, patches, and any other correspondence. Please feel free to
email me with your comments and bug reports.

Future Plans for Yams

This is both a todo list and a wish list. Some items are planned to be incorporated soon and some are definitely long-term if ever.


Version History

0.6.2

17 March 2000

0.6.1

10 March 2000

0.6.0

02 March 2000

0.5.7

15 January 2000

0.5.6

31 December 1999

0.5.5

11 December 1999

0.5.2

0.5.1

0.5.0


Credits

Thanks go out to for their bug reports and suggestions.