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:
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;
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.
Adminstering Yams
The following is a list of possible administration options.
Orders
- View new orders
This option allows the administrator to view all orders with a status of
NEW.
- View all orders
Displays all orders in the system.
- Select Orders to View
Displays a form allowing the administrator to view a specifc order number or
choose the set of order stati to view.
- View Payment Data
This options displays the list of orders and associated payment info and
if the credit card has been charged or not.
- Print Labels
Prints out the shipping addresses for all orders that have a status of
NEW and a product that is of the SHIPPED type in a table.
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
- IN_STOCK
The item is in stock
- ON_ORDER
The item is on order.
- BACK_ORDER
The item is back ordered.
- RETIRED
The item is no longer available.
- SHIPPED
The item was sent to the customer.
- CANCELED
This item in the order was canceled.
Order Status Values
- NEW
No action has been taken on the order.
- ASSEMBLING
The order is in the process of being put together.
- PENDING CHARGE
The order has been filled and sent ot the customer but the credit
card has not been debited.
- FULL SHIPMENT
The whole order was filled and sent to the customer. The credit card
was charged.
- PARTIAL SHIPMENT
Some items were sent to the customer.
- NO SHIPMENT
No items were sent to the customer.
- CANCELED
The entire order was canceled.
Charge Status Values
- UNCHARGED
The credit card has not been charged.
- CHARGED
The credit card has been charged.
- PAID
The credit card charge has been paid into your merchant accoutn.
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.
- Show Departments
Displays a list of all the departments.
- Add a Department
Provides a form for adding a department to the list.
- Show SubDepartments
Displays a list of subdepartments.
- Add a subdepartment
Provides a form for adding a subdepartment to the list.
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
- Show Categories
Displays a list of categories.
- Add a Cateogry
Provides a form to add a category.
Adding/Editing a Category
See "Adding/Editing a Department."
Affiliates
- Show Affiliates
Displays the list of affiliates.
- Add Affiliate
Provides a form for adding an affiliate.
Adding/Editing an Affiliate
To edit an affiliate, click on its name in the affiliate listing. The data
fields for an affiliate are:
- Affiliate Name - name of the affiliate, will show up in any product
listing with a type of AFFILIATE with the text "Buy this item from
affiliate name."
- Buy URL Start - beginning of the URL to direct the user to the
affiliate's page. This can be a URL directly to the page or the path
a redirect script on your own site. The product id, specified in the
product creation, is appended to this URL.
- Image URL Start - this is the beginning of the image URL to display
a small image of the item. This value is override if the "Small Image Path"
is set in the product information. The product id, specified in the
product creation, is appended to this URL.
- Buy URL End - this piece of the URL is appended after the product id.
- Affiliate description - description of the affiliate, only seen in the
administrative side currently.
- Status - specifies whether the affiliate is active or retired.
Products
- Show products by category
Display the products seperated into the various categories.
- Show products by department
Display the products seperated into departments.
- Show products by subdepartment
Display the products seperated into subdepartments
- Add a product
Provides a form for adding a product.
Adding/Editing a Product
Clicking on the product name in any of the listings iwll bring up a form
to edit the product information.
- SKU - Stock keeping unit number. Simply a number used to track the
product internally.
- Name - Name of the product as it will appear to the customer.
- Category - Category that the product is in.
- Department - Department that the product is in. If subdepartments
are turned on, then it will be the department-subdepartment pair
that the product is in.
- Platform - Which platform the products is inteded for.
Possible values are:
- ANY - product works with any platform
- LINUX - products work with linux (*nix) systems
- MAC - product works with Macintoshes.
- NA - not applicable
- WIN - products works with computers runnign Windows.
- WIN/MAC - products works with both Macintosh and Windows
machines.
- Type - What type of product this is. Possible values are
- SHIPPED - indicates a product you have in stock and are
responsible for shipping.
- DROP SHIPPED - indicates a product you sell in conjunction with
a third party who is responsible for shipping the item.
- SUBSCRIPTION - indicates a subscription area of the website.
- DOWNLOAD - indicates a subscription area of the website with
a specific item to download
- RENEWAL - specific form of the subscription used to allow users
to renew subscriptions.
- AFFILIATE - indicates a product displayed on your pages but actual
ordering is done through the affiliate's pages.
- BUNDLE - indicates a product that is composed of other
already existing products. A bundle cannot contain another
product of the BUNDLE type.
- Group Name - Used for subscriptions, downloads, and renewals only.
Specifies the name of the subscription that should be used for
controlling access to this product. To show up in the list, a
subscription must be defined by using the "Add Subscription" option.
- Duration - Used for subscriptions and renewals only. Specifies the length
(in month) of the supscription product.
- URL to download - Used for downloads only. The URL of the product that
the customer bought. Displayed if auto insertion for the downloads products
is turned on.
- Product ID - Used for affiliate products only. Identifies the product
as the middle section of the buy url.
- Affiliate Name - Used for affiliate products only. Identifies which
affiliate this product is being sold through.
- Products in Bundle - This is a list of available products that
can be put into a bundle.
- Short Description - A short description of the product that appears on
the product listing page.
- Long Description - A longer description of the product that appears on
the right side of the display detail page.
- Other Text - As much additional text as you need to describe the product,
appears below the large image and long description on the display detail
page.
- Small Image Path - path to the image to use in the product listing.
- Large Image Path - path to the image to use in the product detail page.
- Price - price of the product.
- Taxable - whether or not the product is taxable.
- Weight - needs to be specified if using the UPS or other dynamic
shipping calculation. Weights of zero are ignored when calculating shipping.
- Domestic Shipping Cost - needs to be specified for calculating shipping
using the static method.
- Internation Shipping Cost - needs to be specified for calculating
shipping using the static method.
- Initial Stock - for products that you keep in stock, how many are you
starting with.
- Threshold Quantity - Eventually there will be a utility that will detect
when an item's stock falls below this value and notifies the administrator.
- Related Products - Choose the products that should be soft sold when
this product is placed into the cart. This option can be toggled by chagning
the value of $display_related in YamsGlobals.pm
- Status - identifies the status of the item. See "Item Status" in the
orders section for more details.
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.
- Name - name of the subscription. This will show up in the popup
menu on the add products page.
- Group Name - this is the name of the group that the user has to
be a member of in order gain access to the subscription
materials. This also requires web server configuration.
- Description - descibes the subscription.
- Status - indicates whether this is an active subscription or
not.
Add User to Subscription Group
Allows an existing user to be added to a subscription group.
- Order Number - Enter the order number in which
the user purchased access to the subscription area otherwise enter zero.
- User name - case sensitive user name that is to be added to the
subscription area
- Subscription - Subscription to add the user to.
- Duration(in month) - How many months to give the user access
for.
User Management
This section provides some basic user management tools.
See also
MAM.
for controlling access and managing web server users.
View Users
- View All Users - prints out a list of all usernames, passwords,
and email addresses.
- View users in group - prints out a list of all usernames, passwords,
and email addresses for the users in the selected groups.
Editing Users
To edit a user, click on the username in either of the above listings.
Add a User
- Username - username of the user being added.
- Password - password for this account.
- Password again - password again to prevent typos.
- Email - email address of the user.
- Add to groups - select which groups the user should be a member
of.