cihanblog
cihanblog

Reputation: 58

Shopping Cart For Non-Members

I have a e-commerce (PHP) system. And it is working now. I decided to allow non-members can order. I'm using session for userid. And i'm storing data in database. But how can i do it for non-members ?

Using Cookie or Session. I couldn't decide it. What is your offer ? Should i store all data in cookie ? Or in database ?

Upvotes: 0

Views: 504

Answers (2)

markpietrus
markpietrus

Reputation: 361

I would store all of the data in the session up until the final step of your order flow and then save the order and customer data to the database.

Cookies only allow around 4kb of data storage and while it is possible to use multiple cookies on a site to increase the total storage space, generally you would store data on the server and only store an identifier in the cookie to retrieve the data. This is how cookie based sessions work as well which is the default session handling type in PHP.

Upvotes: 1

Oswald
Oswald

Reputation: 31647

Storing data in a cookie requires that the user has cookies activated. Store the data in the session.

Upvotes: 0

Related Questions