Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Comments on storing cart info in db??

Status
Not open for further replies.

blackdawg2

Programmer
Feb 6, 2005
3
CA
Might be a simple question, but ... I ran across a shopping cart that is using the database to store the cart information rather than using sessions. The script was written so when you added a product a INSERT query was run storing in the DB.

Is this a secure way of creating a shopping cart?? Any comments would be greatly appreciated - good or bad.

Thanks
BlackDawg2
 
yes, it's secure

it has the advantage that a site visitor can come back later (like, months later) and add more items to the cart before checking out

the disadvantage would only be in the difference in processing time and resources to write a row to the database as compared to writing a row to a session structure

oh, and you'd have abandoned carts taking up database space, but hey, disk drives are cheap nowadays...

rudy | r937.com | Ask the Expert | Premium SQL Articles
SQL for Database-Driven Web Sites (next course starts March 6 2005)
 
On the abandoned carts:

What a great way to see what's driving your clients away. You can actually rebuild their experience by just going to the pages where they added the products. You may find a couple of places where you can streamline the process and have more sales and less of those abandoned carts.

plus if you are saving the right information you can build a bunch of metrics to see what drives your clients and what not.


I'll say go for it.

grtfercho çB^]\..
"Imagination is more important than Knowledge" A. Einstein
-----------------------------------------------
 
1 - What about the prices that are being saved in the db cart. Lets say someone comes back to the site 6 months later and cookies reconizes them and now the prices of the products are more expensive now then they were when they added to cart! What a deal on their end.

2 - What if someone else uses the same computer and goes to the site, now they are viewing someone elses shopping cart!

Any comments on these issues?

Thanks,
BlackDawg2
 
if you store the product id in the cart vice the price, it will have the updated price all the time.

If you don't ask the right questions, you don't get the right answers. A question asked in the right way often points to its own answer. Asking questions is the ABC of diagnosis. Only the inquiring mind solves problems.

-Quote by Edward Hodnett
 
you will have the updated price, yes, but you will also not be able to do "special" pricing, e.g. for a particular preferred customer, or as a result of a complicated lookup of total order volume, sales history, volume discounts, rain checks, etc. etc.

i would store the datetime of the order along with "special" pricing, and then recalculate prices if the order date is earlier than the date of checkout

note, don't recalculate until checkout

rudy | r937.com | Ask the Expert | Premium SQL Articles
SQL for Database-Driven Web Sites (next course starts March 6 2005)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top