Forum Moderators: coopster

Message Too Old, No Replies

ecommerce php

         

adamnichols45

6:01 pm on Nov 25, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Have posted before but really do want to code my own shopping cart .if a user wants to add a product then it will add id code to header file is this the way i should go about this script with global varibles.?

Gibble

6:02 pm on Nov 25, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



umm...no. You should store their shopping cart in a table in the database and use a session to keep track of each shopper.

FalseDawn

6:36 pm on Nov 25, 2005 (gmt 0)

10+ Year Member



You only need to store cart info in the database if it needs to be persistent across sessions (eg user has an account and has to log on to view their cart) - otherwise, storing the cart info directly in the session itself is fine.

lampip

1:08 am on Nov 26, 2005 (gmt 0)

10+ Year Member



i am working on a shopping cart myself and was considering this same question, whether to put the cart details in the session or the database. each product has a lot of customization attributes so will be larger than normal products, should that impact the decision? Is there a limit on the size of a cart before you want to consider putting it into a database. also, we plan on allowing people to save items for later purchase, which will be stored in the database. so the shopping cart itself doesn't need to last beyond the session. given that would you recommend using the session files or should i still consider the database? What do most other people do?

thanks,
peter

chrisjoha

1:30 am on Nov 26, 2005 (gmt 0)

10+ Year Member



I guess most other people don't code their own e-commerce from scratch. It has been done so many times before, and with all the people working on those products, they're most likely alot better, more thouroughly tested and so on than a product you develop alone will ever be. Check out some of the open source CMS'es that have shopping carts, like eZ publish.

FalseDawn

1:42 am on Nov 26, 2005 (gmt 0)

10+ Year Member



IMO, the fact that "a lot of people" work on a product does not make it better. Often, quite the reverse.

In any case, I don't think there's any session storage limit you are likely to run up against. In PHP, storing session data in files is slightly quicker than hooking into the session functions and using the database, but less flexible.

adamnichols45

12:07 pm on Nov 26, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



hmmm - i think i should get my book out then and get reading what you think guys. each product had a picture and 5 or so attributes.