[Pdx-pm] Shopping Cart Logic
Randal L. Schwartz
merlyn at stonehenge.com
Fri Mar 7 05:45:24 CST 2003
>>>>> "A" == A J Weinzettel <aj at linuxaid.org> writes:
A> I am building a custom shopping cart for a customer and I am trying to
A> find a better way to add / delete products from the cart. Here is my
A> 1. Customer adds an item to the cart
A> 2. Check the presence of a cookie
A> a. If no cookie set a unique cookie using time goto 3
A> b. If cookie present goto 3
A> 3. Insert a record into the database with the unique id and product info
A> a. If customer checks out goto 4
A> b. If customer keeps on shopping goto 1
A> 4. Customer checks out and records from shopping_cart table get
A> transferred to products_ordered table.
A> My problem is when a customer does not check out the records in the
A> shopping_cart table get abandoned. I really don't like this idea. I
A> could write a cron to delete the records that are x days old, but I am
A> wanting something that does not require an outside process. What other
A> ways can I keep the database nice and clean?
You can require registration before purchase... and associate the
shopping cart with the person, not the session. Put up a notice
that items left in shopping cart over 30 days are recycled.
This is the Amazon model. Works pretty well.
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<merlyn at stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!
More information about the Pdx-pm-list