0

Django shopping cart

I want to create a shopping cart for my django app, but I don't know, how to start. I'm thinking about getting the session-id and store it to a database together with the item-id. So I think I have to use a cookie for that(?). Is that the right way to go? I'm also thinking about "django-shop". Any experience with that? Can you recommend a video-tutorial?

28th Jan 2021, 9:58 PM
Fu Foy
Fu Foy - avatar
5 ответов
+ 3
cookies if you want to be able to retrieve content automatically at server side, but you could also handling cart only with web storage (modern/html5 cookies version, without exchange with server), and transmitting data on demand (post/get http requests and/or ajax -- XML http -- requests)
28th Jan 2021, 10:25 PM
visph
visph - avatar
+ 2
Fu Foy I think that shopping cart handling would be easiest implemented on client side... anyway, roughly on server side, you should effectively use session id to keep track in database (meaning you are connected to the site -- ie: no anonymous session -- or you must find a way to identify the visitor)
28th Jan 2021, 10:10 PM
visph
visph - avatar
+ 1
Thanks! I will check this out tomorrow. Web storage seems to be, what I'm looking for.
28th Jan 2021, 10:29 PM
Fu Foy
Fu Foy - avatar
0
Thanks for your answer! Client side = using cookies? Sorry for the question, but I'm a beginner.
28th Jan 2021, 10:20 PM
Fu Foy
Fu Foy - avatar
0
Great! Thanks again for your advise. In django I used: respone.set_cookie(key,value), which saves a cookie for the session. I'm not sure, wether this is the html web storage, but it solved my problem.
29th Jan 2021, 12:45 PM
Fu Foy
Fu Foy - avatar