Add Product To Cart - Django Wednesdays ECommerce 13

preview_player
Показать описание
In this video I'll show you how to add products to the shopping cart.

We want customers to be able to click on an item and add that to our Shopping Cart.

We also want to keep track of those items if they leave the site and come back later.

Sessions will allow us to do that, and Javascript and JQuery will help us out...

#django #codemy #JohnElder

Timecodes

0:00​​ - Introduction
1:00 - Add JQuery To App
2:10 - Add To Cart Button
4:20 - Add Javascript
11:20 - Cart_Add View
16:21 - Create Add Function To Cart
18:50 - Troubleshoot
20:14 - Test It Out
20:42 - Check Session in Shell
22:46 - Conclusion
Рекомендации по теме
Комментарии
Автор

▶ Watch Django Wednesdays Ecommerce Playlist ✅ Subscribe To My YouTube Channel:
▶ See More At: ✅ Join My Facebook Group:
▶ Get The Code

Codemycom
Автор

Hi John,

Thank you very much for your course. I'm having a bit of trouble here. When I click the cart button, there is no response in the network tab. I’ve checked the code and there are no errors or warnings. Could this be due to an issue with my environment configuration?

王道瑞
Автор

Thanks John, from here in the UK. A super tutorial again (just recently found you while trying to make sense of a 5 yr old eccomerce tutorial where all the requirements.txt files were out of date so got a bit lost ha .. a big learning curve in this session for sure but a good feeling when get a 200 server code. Think the JavaScript course is next on the cards! :)

JK-nxwd
Автор

AMAZING lesson like always. If I may I have a qst, I watched some past playlists and you always used models instead of sessions so my qst is: is it necessary to use sessions and not create a model for carts or is it solely because it can update the value without refreshing the page?

houcembahi
Автор

Whoa that was a bit to take in! I literally know nothing about JavaScript so may need to learn more about that, especially when I'm also trying to understand HTMX (not related to your course here) Great work as always John! Off to the next video as I'm a bit behind :D

namdarcs
Автор

Hey John, In this tutorial you didn't use login decorators. Anyone can add product to cart and move to billing and payment without even registering. I hope you will address this small issue in upcoming video.
You are doing great. Thank you.

nexusbeing
Автор

Awesome series! can't wait to next wednesday!

andresgiuffre
Автор

Good Morning
Thank you, i had some issues with the concept of cookies and sessions
Now i got
Just finished #13
Waiting for #14 next week

technologybysrk
Автор

Woow, congralutions for tutorial, my friend. I'm from Brazil and I follow you here on YouTube
When will the next video come out changing the view and cart?

euleozera
Автор

would it not be better to instead have my product buy form as a django form that posts data to the view, then the view can handle all the data and all the products to the cart, because my products will have further possible variations for some products, that in turn effects the price, furthermore, I also have things like quantity that need to be processed?

amaansaleem
Автор

Great tutorial John, thanks.
By the way, anyone having error like this :
"TypeError: argument of type 'NoneType' is not iterable" in line > if product_id in self.cart. any idea how to solved it?

renanrivera
Автор

On the Jsonresponse line I get TypeError: Object of type set is not JSON serializable

MacaireAlexander
Автор

One thing i dont understand is that you are not relating the models (Product and cart in this case) to the user. So in theory with your code, all user would share the same Cart and Product objects!

can you please tell me if this is correct?

ciangianluca
Автор

I was trying to do a pricing section on my website using this, however I faced an issue where no matter what button I clicked for my pricing package. it was always the same ID and name being retrieved, I fixed that with var product_id = $(this).val(); in the script

If anyone was facing the same issue ..

Thank you for the series. Looking forward for more. You are awesome!

mohammadslim
Автор

I am get an error just in this video add/ 500 xhr

BlackCodeDev
Автор

Is anyone else getting a namespace or reverse error in the url within the <script> code? My vscode is saying it needs a ", " at the end of the url.

johnjim
Автор

I'm get the value error in cart/add and not shown the console in browser

sheezalmuneer
Автор

Great tutorial
By the way, anyone having error like this : TypeError: int() argument must be a string, a bytes-like object or a real number, not 'NoneType' ? pls need help

allandekengni
Автор

I have a problem bro ... I don't get any errors and concole doesn't show anything either this code

cristiano_urm
Автор

If I log out, it will be gone, right?
What do people usually use for cart models or sessions?

shivamsingh