How to make a shoppingcard

Hi.

How do I easily make a shopping card. Only requirement is, that it has to be some kind of cookie based, so the shop remember the users basket - also the day after.

What is the best way? I am thinking something like:
Make a user session in global asa when a user enters the site.
when the user adds a product to basket, this operation is performed direct in the database.

Does anybody have a alternative idea?
Jesper ChristensenProgrammerAsked:
Who is Participating?

Improve company productivity with a Business Account.Sign Up

x
 
OriNetworksConnect With a Mentor Commented:
By class i was asking if it was for a educational project. You may want to look at existing shopping cart packages to see how they work, such as ZenCart. It is not a good idea for a beginner to make shopping cart applications to be used in real world instances.

I would store user contents in a database that stores information about the users session and have a cookie written to the users computer that stores a session identifier and maybe some kind of validation or hash to prevent modifying cookie information to prevent hackers from impersonating another users session.
0
 
OriNetworksCommented:
The correct term is shopping cart. Is this for a class or a real business?
0
 
Jesper ChristensenProgrammerAuthor Commented:
What du you mean by class?
Its for real business
0
 
Jesper ChristensenProgrammerAuthor Commented:
So... You wount use sessions. Only a cookie id? So i Will Make a cookie request ón every pake?
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.