views:

60

answers:

1

After a successful Paypal payment, I receive the IPN and the payment creates a new order. However, the shopping cart does not clear.

Rather than wait for the IPN I would like to alter the payment.view.checkout.success code to clear the cart after a successful payment.

The code to empty the cart is:

for cart in Cart.objects.filter(customer=order.contact): cart.empty()

However, unless I log-in before I select an item, in my database the customer field in the cart is null. Also, if I don't log-in at all (i.e. if I'm not a registered user) then the customer field is always null. This would seem to make it impossible to find the necessary cart. Should the customer field ever be null after a purchase is made?

If not, any advice on how to fix this?

If it can be null, any advice on how to empty that cart?

Thanks for you help,

Todd

A: 

You probably have it figured out. http://www.mail-archive.com/[email protected]/msg04419.html is discussing the same issue.

L Jiang