Google Groups

Q: Multiple Cart Objects Returned at 'succesfull' checkout. What goes wrong?

Coen Apr 19, 2012 9:28 AM
Posted in group: django-shop
Hello group,

I'm new to django-shop and like it! I got quite far. But now I'm stuck. :/

In my shop, when a payment is successful the payment backend calls confirm_payment(order, amount, transaction_id, save=True). The first time this works fine. There is only one cart-item in the db. If there are more than one carts I get this error:

MultipleObjectsReturned at /shop/pay/ideal/report/
get() returned more than one MyCart -- it returned 2! Lookup parameters were {'user': None}

/shop/pay/ideal/report/?transaction_id=### is requested ul by the bank to indicate the transaction is finished.

All cart objects have user_id null. Because I don't let users login. But with multiple carts in de db the django-shop payment api can't get the cart_object by user:

/Library/Python/2.6/site-packages/django_shop-0.0.13.dev0-py2.6.egg/shop/payment/ in confirm_payment
cart_object = Cart.objects.get(user=order.user)

How can I keep track of transaction-user-cart relationships without having my customers to login? Or am I missing something else?
All help and suggestions are appreciated!