At 09:56 AM 1/11/2010, Johnny Withers wrote:
Victor,

The temporary table solution is not a good one. Use a single table and store
each item put into a cart identified by the session ID of the user. A
process should clean out this table periodically since there are "shoppers"
that abandon carts from time to time.

The design of this table could be quite simple:

id - int auto_inc
session_id - varchar
added_dt - datetime
item_id - int
quantity - int

You could get more complicated depending in your need an item requirements
(colors, sizes, etc).

-JW

I also agree with JW, a single table is better. Don't forget shoppers may spend 30 minutes of more filling up their shopping cart and may lose the connection to the site or have to exit without completing the order. You need to retain the registered user's shopping cart so he can go back to it later. Only delete it if there is no activity on it for 7-10 days. If you use temporary tables and throw out the shopping cart contents if the session is lost, then you will *iss off a lot of customers.

Mike



On Mon, Jan 11, 2010 at 9:30 AM, Victor Subervi <victorsube...@gmail.com>wrote:

> On Mon, Jan 11, 2010 at 10:49 AM, Baron Schwartz <ba...@xaprb.com> wrote:
>
> > Victor,
> >
> > > That strikes me as messy. Each tmp table has as many rows as necessary
> > for
> > > the products that are to be bough. To do as you say I would have to
> > create a
> > > table with a zillion rows to accommodate however many products I
> > *predict*
> > > buyers would buy. Therefore, I guess I should probably create a new
> > database
> > > so as to not make a mess of the main database.
> >
> > You fundamentally misunderstand relational database design.  I suggest
> > reading this book:
> >
> >
> http://www.xaprb.com/blog/2009/08/22/a-review-of-beginning-database-design-by-clare-churcher/
> >
>
> LOL. Ok, I'll put it on my list. *In the meantime*, since I am reworking my
> database design for the shopping cart I just finished building and need to
> get this up __n_o_w__, what would your advice be?
> V
>
> >
> > Regards,
> > Baron
> >
> > --
> > Baron Schwartz
> > Percona Inc: Services and Support for MySQL
> > http://www.percona.com/
> >
>
>
>
> --
> The Logos has come to bear
> http://logos.13gems.com/
>



--
-----------------------------
Johnny Withers
601.209.4985
joh...@pixelated.net


--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/mysql?unsub=arch...@jab.org

Reply via email to