I noticed that there are no signals for items being removed from the cart. I had a need for these so attempted to implement them myself. The patch is attached.
The signals are based on the existing satchmo_cart_add_{verify, complete} signals. However at present satchmo_cart_remove_verify is never raised because Cart.remove_item doesn't seem to be called anywhere.
The signals are also being sent from the add/remove_ajax methods, but these are untested as I have no ajax code in my project.
This is my first foray into editting the satchmo code so if I've made some major errors then please let me know!
Comments (3)
-
-
-
assigned issue to
-
assigned issue to
-
- changed status to wontfix
Instead of new signals you can be probably use:
django.db.models.signals.pre_delete.connect(your_listener_1, sender=satchmo_store.shop.models.Cart) django.db.models.signals.pre_delete.connect(your_listener_2, sender=satchmo_store.shop.models.CartItem)
in your code.
There is a difference between importace of special signals for adding and removing. You probably do not need ever to polite forbid removing. Also generic signal is sufficient.
- Log in to comment
Hi,
pasting your patch here.
For this hunk:
Could you make your # doc follow the rest (ie. # <signal>.send(...))?
Also, I don't see why
satchmo_cart_remov_verify
should be added if it isn't used.What's this doing here?
Could you move those out and put it near where we trigger
satchmo_cart_changed
?I believe the signal has already been triggered in
_set_quantity
, so this isn't needed.