Gossamer Forum
Home : Products : Gossamer Links : Discussions :

Shopping Cart / Catalog

Quote Reply
Shopping Cart / Catalog
Here are some preliminaries:

User logs in. Uses standard Links logon/database.
Any change in email address requires a re-verify before any changes are accepted (valid Email)

The shopping basket will stay around for up to 30 days.
The session expires, but when a user re-logs in, it will check for an existing basket.
if found, the basket items will be re-checked against the database, and any items nolonger available will be marked "unavailable"

This is an object concept of "current order" and "past orders"

When an item is selected for the users basket, a temp-hold is put on it, for as long as the session ID is valid (1 hour, 2 hours 3 hours, etc).

If a session expires, the item's status is returned to 'available'

This allows the first user temporarily get custody of an item, and for anyone else interested to be notified if that item becomes available ie: the first user does not complete the sale in the alloted time.

======

The User database can hold whatever information you want to put in. I vote for a "user extra" database, linked to the users database by UserID. If credit card information is stored, you are better storing them separately, and perhaps broken up. That is "fine tuning" and not a part of initial development.

Once the User is verified, they are allowed to shop (a non-verified user can shop/browse, but cannot set up a shopping basket)

======

The user selects an Item.

An Item has:
a unique identifier: Item #, LinkID, SKU, UPC, etc. (or all of them)
Name: Item's name
Description: a paragraph or two about the item
Short_Description: a short description to be used in brief links.
Title: could be same as "Name" but offers a chance to use a different string as the catalog entry of the item
price: $$
Weight:
Size:
Length:
Width:
Height:
Color:
multiple_Prices: Y/N : if multiple price entries exist (this is a time-saver flag only)
Picture: Y/N : Again, a time saver flag only. If "Y" the Picture database will be checked.
Discount: Y/N : again, a time saver flag only. If "Y" the Discount's database will be checked.


These are suggested fields, more can be added.

The Pictures database will contain:

ID: (unique picture ID)
ItemID: The ID of the item the picture belongs to
Height:
width:
Caption: The alt-text and/or image description.


The Pricing Database will contain:
ItemID:
Quantity: Number to purchase for that price
Unit Price:
Weight:
Discount: any discount applied to this pricing.

==========


The reason for the the pricing database, rather than the columnar format (1, 2, 5, 10, 25, 50, etc) is because in my situation most items are available in only a quantity of 1, so that price goes into the record for speed. Where additional quantities exist, each item has a random amount available. It's better to not hard-code the prices for items, unless your items are all the same. Even then, you start to lock yourself into stock pricing. With this system, you can select a standard pricing, just by entering the same values for each record, or mixed pricing just by entering different values.

The Same can be said for the pictures. Not all items may have pictures. By setting the Y/N flag, you can save a select statement if it doesn't. If it does, it will find _ALL_ the pictures. This may get more sophisticated by assigning a different "category" for each of the images, so that the program will format them correctly.

The next is an "Inventory" database, and supplier database, but that has not been figured at this time. Again, I'm assuming a quantity of '1' so if I enter an item, I have it, if it sells, I don't. Other people will want to enter an available quantity. And, then, available quantity has to be checked against any discount pricing, and whether any more can be ordered.

Gets complicated really, really fast.

===========


Orders are fairly easy, unless I start to make it harder. An "order" is a collection of items added to the shopping cart, that get tagged to the "order" entry which includes the user information, and other information. This is a REDUNDANT field, so that if any information is changed later, the ORIGINAL order information remains unchanged.


=======

Any suggestions/comments/etc. Now's the time.



PUGDOGŪ
PUGDOGŪ Enterprises, Inc.
FAQ: http://postcards.com/FAQ


Quote Reply
Re: Shopping Cart / Catalog In reply to
Pugdog:

You may want to add a field for shipping costs...

or possibly a whole table so that you can price shipping USPS, FedEx and UPS...

Good luck!

Dave

Quote Reply
Re: Shopping Cart / Catalog In reply to
Shipping costs are a real problem.

Briefly: The cost per unit may be high if that is the only item being offered. If they buy 2, perhaps there is no additional cost? Or maybe, the costs double. Perhaps, sending 2 the costs MORE than double. (It's possible).

How would you handle this sort of thing?

I'm totally against hiding shipping in the product price, and using standard/stock $6 per order, $2 per item for anything unless you have all of the same sort of products, such as DVD (and even then, with the special-editions, the size/weight changes for some items).


PUGDOGŪ
PUGDOGŪ Enterprises, Inc.
FAQ: http://postcards.com/FAQ


Quote Reply
Re: Shopping Cart / Catalog In reply to
I agree, plus if you offer multiple shipping options, then it can become quite hairy in terms of calculating the price accurately.

Regards,

Eliot Lee
Quote Reply
Re: Shopping Cart / Catalog In reply to
The more I work on this, the more I keep wanting the Interchange code to work. Everything I want to add in, is already there.

It's open source, GPL, meaning it's free to modify to make work with Links.

Anyone interested in trying to do this??

That way more time could be spent on interface issues, specific to links, and still benefit from the "back end" order processing code in Interchange.


PUGDOGŪ
PUGDOGŪ Enterprises, Inc.
FAQ: http://postcards.com/FAQ


Quote Reply
Re: Shopping Cart / Catalog In reply to
hi pugdog,
i would suggest the following solution:
you can make a table with shipping type and shipping range that is based on either the weight or the total cost. thatīs what matt wright did with the shopping cart in the cookbook.
type from (weight or price) to cost in currency or percent
fed ex:0:49.99:6.99
fed ex:50:1000000:8.99
and so on.
I think the script is much more better than the code I produced / messed up for our shopping site. It would be a honour for me if I could help develop a good script to make links sql work as a shopping cart. I sent you the url that you can take a look at the basic code (I replaced some of the features and the weight dependant freight cost)

Cheers
Niko

http://www.master-productions.com
Quote Reply
Re: Shopping Cart / Catalog In reply to
The more I think about it, the more I keep going in circles.

I keep looking at what the catalog needs, and it seems quite simple. Yet, looking through the minivend/IC code, there are things I wouldn't even dream of adding in, and features that are nice, but beyond trying to duplicate.

The more I go through the mv/IC code, the more I see mounds of legacy stuff, like DNA 1% used, 99% unknown <G>.

The user database is already here in Links. The template parser, and routines for adding, updating, and retrieving records from the databases exist.

The mv/IC project has a great search-query editor, but it has a lot of overhead because it supports flat file, dbm, gdbm and SQL databases.

Thinking about the User records....

Currently Links stores a Username and Session in the cookie, that is used to identify the user in the database.

That Username and Session ID canbe used to enter the items in their shopping basket into a database entry, that is double keyed -- username and session. If the session expires, there are still the old Userame entries to prompt the user "These items exist in your current basket" and then update the old session ID with the new one.

Update Sessions set SessionID=session where Username = Username

The user then can delete/add/edit the items in their old basket.

Orders require several additional databases, for security and safety reasons. An item-order database that stores the order# item, price, etc for each line item in the order, an Orders. database that stores the various features of the order such as any discount, ship-to, and other information, and a payment database linked to the Order database. This is so if a user changes their profile information, the information attached to the individual order is not changed. To call up an order, you use the Username, select from the Orders table, then join/select on the item-order database and the payment database. (tables). in that way you've reconstructed the order out of one piece of data -- a Username, and it's a replica of the original placed. A Username account history, would be a query on the Orders database for the single line summary of each order. A click on the order number would get the specific items for that order.

This doesn't seem hard, unless I'm really missing something. All this is functionality that exists, and just has to be tied to getther with a few templates and some SQL queries.

That's 1/3rd of the puzzle -- order handling.

The other two thirds are the catalog and payment/transaction gateways.

For the catalog, as described before, I see the Item database, a pricing and a photo database. The catalog is generated in a similar fashion to the links database currently. Dynamically -- not statically -- so current values are always used.

The one area I'm stumbling on here is "product grouping" and I wonder if it's an area of complexity better just thought about, at this point.

The same, or similar syntax for products can be used when entering their descriptions, such as choice1|choice2|choice3 which would generate a drop-down list rather than entering each of the products individualy. This too can get complex, but where a product comes in 6 colors and 5 sizes, one entry should be sufficient if the pricing or SKU would be the same. This is "matrix" stuff, and there are many ways to handle it, maybe again, best left for the 2.0 release.

The third section, transaction gateway, is someting that I have no real intention of doing anything with -- hopefully someone else will be really inclined. This is where the order is submitted for payment, and then post processed. The order can be easily formatted into any format required, since all the data is stored in an SQL format database. Line items, totals, tax, handling, etc can be flagged separately, or only a total, be submitted. The post-processing only needs to know what to expect back from the transaction processer and do one set of actions if successful, and another set if not successful.

So, I can see all three areas of the system easily developed or modularized, and ready to be upgraded and worked on.

This needs several more people to be involved. There are too many parts that need to be done -- including the user inteface and basic templates. More discussion on the format of the database, and program flow.

I have a very basic version working, and these basic extensions are not initially hard. But, fine tuning it will be.

The new integrated editor, and other features of the new links may make it even more attractive (or harder <G>).

So much to do.

PUGDOGŪ
PUGDOGŪ Enterprises, Inc.
FAQ: http://postcards.com/FAQ


Quote Reply
Re: Shopping Cart / Catalog In reply to
Pugdog:

I agree, too.... shipping is a BIG unknowable. You coulkd base shipping on TOTAL weight. But a lot of times, the same sweight will be different amounts based on how far it is shipped (in addition to total weight.) And if that was not enough, the SIZE come into play.

I can understand if you just did not want to touch this... and I do NOT blame you! But if you did decide to throw an extra table in for this, you could always be liberal in shipping cost quotes... which could be lowered for the actual shipping. I never had a customer who complained for a price LESS than quoted!

I would be happy to help out, but I do not have a whole lot of skill writing code. I have a very simplistic shopping cart I wrote and run online, and it works (for me). If you would like me to help, please feel free to e-mail me direct at:

dkoch@aros.net

Dave

Quote Reply
Re: Shopping Cart / Catalog In reply to
Well, once there are more ideas, and we can break the project up into smaller units there should be plenty for different people to do.

Once things start getting fleshed out, there are also going to be needed those who can add to existing code, or clean it up.

Template designers for a standard set of templates ... and the way these programs go, _everything_ is a template, so there will probably be hundreds <G>... just look at the new links.

I would like to get as much dynamically generated -- as one of the threads here with Alex explains -- so that the templates just output what the program sends them, without overriding or making judgements about it. A subtle concept, but the add.html form is a good example. add_error.html only shows what you program into it, not what add.html/add.cgi really send it.



PUGDOGŪ
PUGDOGŪ Enterprises, Inc.
FAQ: http://postcards.com/FAQ


Quote Reply
Re: Shopping Cart / Catalog In reply to
Here is an update of the database, with field definitions. Comments ENCOURAGED!!

Code:
## Items
## IID is a user-defined field for catalog numbers
## Status can be expanded into a separate table, but for now, ENUM is sufficient.
#
CREATE TABLE Items {
ID int(10) unsigned DEFAULT '0' NOT NULL auto_increment,
SKU varchar(20) DEFAULT '' ,
UPC varchar(20) DEFAULT '' ,
IID varchar(20) DEFAULT '' ,
Name varchar(100) DEFAULT '' ,
Description text,
Short_Description varchar(250) DEFAULT '' ,
Title varchar(100) DEFAULT '' ,
Price decimal(12,2) NULL ,
Weight varchar(20) DEFAULT '' ,
Size varchar(20) DEFAULT '' ,
Length varchar(20) DEFAULT '' ,
Width varchar(20) DEFAULT '' ,
Height varchar(20) DEFAULT '' ,
Color varchar(30) DEFAULT '' ,
Date_Entered date DEFAULT '0000-00-00' ,
Date_Expired date DEFAULT '0000-00-00' ,
Status enum('Active','Inactive','On Order', 'Available', 'On Hold', 'Discontinued') DEFAULT 'Available' ,
Multi_Price enum('Y','N') DEFAULT 'N' ,
Picture enum('Y','N') DEFAULT 'N' ,
Discount enum('Y','N') DEFAULT 'N' ,
PRIMARY KEY (ID)
}

## Pictures
## Field_Info is used to assign a specific picture to a specific area of the template
## Path_Info is used if there is no default image directory, or can be assigned a category default
#
CREATE TABLE Pictures {
ID int(10) unsigned DEFAULT '0' NOT NULL auto_increment,
ItemID int(10) unsigned DEFAULT '0' NOT NULL ,
Name varchar(20) DEFAULT '' ,
Path_Info varchar(150) DEFAULT '' ,
Alt_Text varchar(100) DEFAULT '' ,
Caption varchar(250) DEFAULT '' ,
Height int(10) unsigned ,
Width int(10) unsigned ,
Field_Info varchar(20) DEFAULT ''
PRIMARY KEY (ID)
}


## Pricing
## Table could have multiple prices added, with date prices take effect, and/or expire
## If a discount specified, the Item.Price is used, and discount taken.
#
CREATE TABLE Pricing {
ItemID int(10) unsigned DEFAULT '0' NOT NULL ,
Quantity int(10) unsigned DEFAULT '0'
Q_Price decimal(12,2) NULL ,
Q_Weight varchar(20) DEFAULT '' ,
Q_Size varchar(20) DEFAULT '' ,
Q_Width varchar(20) DEFAULT '' ,
Q_Length varchar(20) DEFAULT '' ,
Q_Height varchar(20) DEFAULT '' ,
Q_Discount varchar(20) DEFAULT '' ,
Q_Description varchar(250) DEFAULT ''
}



.


PUGDOGŪ
PUGDOGŪ Enterprises, Inc.
FAQ: http://postcards.com/FAQ


Quote Reply
Re: Shopping Cart / Catalog In reply to
Here's an update to the Items table:

Code:
CREATE TABLE zItems (
ID int(10) unsigned DEFAULT '0' NOT NULL auto_increment,
SKU varchar(20) DEFAULT '' ,
UPC varchar(20) DEFAULT '' ,
IID varchar(20) DEFAULT '' ,
Template varchar(30) DEFAULT '' ,
Name varchar(100) DEFAULT '' ,
Description text ,
Short_Description varchar(250) DEFAULT '' ,
Title varchar(100) DEFAULT '' ,
Price decimal(12,2) NULL ,
Taxable enum('Y','N') DEFAULT 'N' ,
Wholesale_Price decimal(12,2) NULL ,
Wholesale_QTY int(10) DEFAULT '' ,
Weight varchar(20) DEFAULT '' ,
Size varchar(20) DEFAULT '' ,
Length varchar(20) DEFAULT '' ,
Width varchar(20) DEFAULT '' ,
Height varchar(20) DEFAULT '' ,
Color varchar(30) DEFAULT '' ,
Date_Entered date DEFAULT '0000-00-00' ,
Date_Expired date DEFAULT '0000-00-00' ,
Status enum('Active','Inactive','On Order','Available','On Hold','Discontinued') DEFAULT 'Available' ,
Multi_Price enum('Y','N') DEFAULT 'N' ,
Picture enum('Y','N') DEFAULT 'N' ,
Discount enum('Y','N') DEFAULT 'N' ,
Related enum('Y','N') DEFAULT 'N' ,
Featured enum('Y','N') DEFAULT 'N' ,
Download enum('Y','N') DEFAULT 'N' ,
PRIMARY KEY (ID)
);
.
Notice, the last fields are fields that may not have a fixed value, and which may have anywhere from 0 to multiple values. They are put into separate tables.
The program knows there exist these values by the Y/N fields. Each of those fields can open a sub-window in the enter item field, with it's own routines to handle it -- such as the Download. If the item is a download, you'll be able to specify all the details you'll need for that item, but those details are not stored for every item. Same for pictures, featured, related, etc.

Featured can be a simple Y/N flag, or it can be a routine to determine some other functions.

Related is a table that creates an association between this product and other products. Perhaps this can be auto-generated in the way "Other people who purchased this item..." type feature.

Database design is critical... all the routines exist already, and just need to be linked together for inputting the data, and creating relations.

The Template field is so that you can use one of the default templates, or you can use a custom template.

PUGDOGŪ
PUGDOGŪ Enterprises, Inc.
FAQ: http://postcards.com/FAQ


Quote Reply
Re: Shopping Cart / Catalog In reply to
JavaScript:

I need a script that will, when a select box is changed, say from Y to N or Vice Versa, open an input window, with a template/form. Basically, it would need to open a popup window, with the url of a script which is passed some data.

I also need a script that creates two or three select lists on a screen, and lets you move items between with the arrow keys. I had one, but can't find it.

Right now, I don't have time to re-learn javascript... so if anyone knows this stuff, and wants to contribute... here's one way :)

PUGDOGŪ
PUGDOGŪ Enterprises, Inc.
FAQ: http://postcards.com/FAQ