Django Ecommerce Website | Add to Cart Functionality | Part 3

preview_player
Показать описание

We will begin to add in core user functionality such as “add to cart”, “update cart” and “checkout”.

Source code:

Follow me on Twitter for updates and more personalized content:

Time Stamps:

00:00 - Introduction
3:00 - Add/Update cart event handlers
13:05 - "updateItem" view
21:05 - Create CSRF Token
23:50 - "updateItem" view logic
26:45 - Create Order/OrderItem
30:42 - Render cart total
35:40 - Update cart quantity
38:48 - Shipping Form Logic
50:00 - Make Payment Button
56:28 - Checkout Form Data
1:1:17 - Process Order
Рекомендации по теме
Комментарии
Автор

God..the level of hard-work you did...for free

debashishchakraborty
Автор

I looked for a good ecommerce Django tutorial in many sites, but none of them can be compared to Dennis tutorial. His tutorial is:

1. complete
2. very well explained
3. It can be used as a template for many others applications.

Thanks Dennis.

sandrooliveira
Автор

INTERNAL SERVICE ERROR OR KEYERROR SOLUTION!!
If you guys are having a KEYERROR problem there can be a couple of things that this is occurring.

1. There is a typo in your code so start over the video and look over your code you inputted.
2. The code is not formatted correctly so make sure all indentation and structure is up to par with the code is on the video.

My problem was that I wrote 'action' with a c at the end and went back to the video and saw what Dennis was explaining which files were being used to run the 'action' code and saw my mistake in the store.html file. I was stuck for a while but I was glad I figured it out.

I hope this helps.


UPDATE: Another possibility for a keyword error is not using "" on {{product.id}} in the store.html file. In the video Dennis did not use it and for some reason he did not get the error message on the console. Weird but ok.

rubenarellano
Автор

Dennis thank you so much for this free tutorial. at 26:08 there was a cut in this video and you changed def updateItem() data = json.loads(request.data) to json.loads(request.body). I had an error with this because i was following request.data. Pin this guys to help other people. I guess you will have the same error as mine. just change it to request.body

shadowfiend
Автор

You are the one who explains each and every thing. This is most beginner friendly tutorial I have ever seen on Django ecom website..

nishantnarsale
Автор

This particular video of the lesson had a tight learning curve for me because of no java-script background but I am amazed at how great your tutorials are.... God bless

isaacmukama
Автор

This course is an insane, complete and amazing course.

marinaalmeida
Автор

I love the way you keep everything organized, that make it really easy to follow and understand, thank you so mush. respect from morocco

hakimtag
Автор

Anyone has the problem with the 500 (Internal Server Error) problem, you should also notice in the terminal it said WSGIRequest object has no attribute 'data'. If you search this problem, actually some commands offer the correct answer. They are same problems show in different places. You just need to change the views.py updateItem data=json.loads(request.data) to request.body. Ask the right question. you will get the right direction.

goodhourui
Автор

Hey Dennis. I believe your work will bring joy to many people in the future. May your creativity shine bright in the days to come. Good Job...

NaveenKumar-irgb
Автор

00:00 - Introduction
00:45 - cart.js
3:00 - Add/Upadate cart event handlers
13:05 - "updateItem" view
21:05 - Create CSRF Token
23:50 - "updateItem" view logic
26:45 - Create Order/OrderItem
30:42 - Render cart total
35:40 - Update cart quantity
38:48 - Shipping Form Logic
50:00 - Make Payment Button
56:28 - Checkout Form Data

DennisIvy
Автор

I've been stuck on this for a week, so blessed I found your tutorial the day before submitting my assignment. Many thanks <3

LeWarGaming
Автор

Thank you for these crystal clear tutorials, love all of them!

ethiotech
Автор

Really love ur style of teaching. The moment if you ever decide to make an actual course for purchase I'll be in there! Again, thanks for ur content . Helped tremendously

IDevotions
Автор

Your videos, now have your channel openned on one of my windows constant and follwoing every tutorial... And have plans visiting previous tutorials when I am done with this ecommence. You are an aweseome teacher, just shouted now at functionalities i see. Almost 3 months into Django and i am loving it now more than ever. Thanks once again

ekwogeblaise
Автор

Oh this is loaded.. I need to create and analyze this over and over again to process in my brain..I need a lot of research..but thanks man.. I like the way you teach it very clear

christianvillegas
Автор

For the Render cart total section, I used context processors. Because I had many views, instead of repeating code in all view functions, it is practical to use context processors.

babanazargutlygeldiyev
Автор

You could use context processors for the cart total:

Create a file 'context_processors.py' in the store app
from .models import Order, OrderItem

def total_cart_items(request):

if
customer = request.user.customer

order = Order.objects.get(customer=customer, is_complete=False)

if order:
orderitems =
qty = sum([item.quantity for item in orderitems])

else:
qty = 0

else:
qty = 0

return {'qty': qty}

Then in settings.py, add
'store.context_processors.total_cart_items',
to TEMPLATES > OPTIONS>context_processors

Then simply call {{ qty }} in the navbar - Create navbar as a partial.

This works for registered users. It does not take into account guest users.

Thank you Dennis for your videos. They are really helping me!

slk-xc
Автор

I have seen no other video as good as this series! Really cool!
You teach the way that django looks really easy.
You've also taught frontend technology in the best manner. I've got clear understanding on every topic.

sayadahmedshaurov
Автор

Hi dennis, I am really happy you made this course available for free. And I admire you for that.

thedjangoway