M
M
magary42017-10-24 16:55:27
symfony
magary4, 2017-10-24 16:55:27

How to make a shopping cart for anonymous users?

the task is to store an array of some id-shnikov in the database for each user
catch - after logging in anonymus, the user needs to merge 2 arrays of id-shnikov (let's say yesterday, as logged in, he put something in the basket today he went from another device as anonymous and put it again) I'm
thinking of making a table with the
user_id, sess_id, basket fields for the anonymous, we
get it by sess_id for the one logged in by user_id. After login, we merge the record to the one found by the current user_id and by the current sess_id
, maybe there is already a similar bike?
I can’t find
just a simple solution and not a full-fledged shopping-cart
Thank you

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexander Taratin, 2017-10-24
@magary4

Don't do it at all. Store locally in the browser in localstorage.
After login, send to the server.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question