products can't be added to cart for anonymous users

53 views
Skip to first unread message

Karsten W. Rohrbach

unread,
Sep 16, 2013, 7:46:06 AM9/16/13
to djang...@googlegroups.com
Hi all.

I am currently implementing a small shop on a django-cms site.
(django==1.5.3, django-cms==2.4.2, django-shop==0.2.0, django-shop-simplevariations==0.0.4)

I got a custom Product model, which works well. The products are referenced via a django-cms plugin, that adds the products via a small template containing a form pushed to the url 'cart_update'. This works perfectly if I am logged in as any valid user. When I am not logged in, the cart stays empty after trying to add the product. When I create a cart modifier middleware with a typo to drop into werkzeug debugger, the session has no cart_id, and my cart has no pk, it is empty. when i cart.save() via the debugger, everything seems to start working.

If I understand correctly, the cart should be instantiated in shop.views.cart:47 via get_or_create_cart().
Looking at shop.util.cart:74 I see, that cart is only saved, when get_or_create_cart() is called with parameters save=True.
Shouldn't the cart be saved somewhere there?

I'm still trying getting my head around the inner workings of the cart, its intended design and its possible magic innards and, so please excuse if I'm missing something obvious.

Where do I need to look to debug this behaviour, or is it by-design?
What's the magic incantation to allow for anonymously submitted carts?
Is there a well-known recipe, perhaps?
I must admit that I'm pretty clueless right now, so I am very grateful for any ideas and pointers where to look.

Best,
Karsten

Zach White

unread,
Jan 21, 2014, 12:10:45 AM1/21/14
to djang...@googlegroups.com
Did you ever end up finding a solution to this?
Reply all
Reply to author
Forward
0 new messages