django-shop icon indicating copy to clipboard operation
django-shop copied to clipboard

Swap product to watch list from add2cart on product detail

Open racitup opened this issue 7 years ago • 5 comments

Pressing the Watch product button on the add2cart panel on the product detail page currently runs addToCart('{% url 'shop:watch-list' %}', {watch: true}). If on the modal you then hit one of the proceed buttons, the product will be added to the watch list (quantity = 0) only if not already in the cart (quantity > 0). If the product is already in the cart and the user presses Watch product, essentially nothing happens. I would expect the product to be removed from the cart and switched to the watch list (quantity = 0), as it does when you hit the Watch item button in the cart.

Is this a bug and is there an easy way to fix it? I've been looking through the code and it looks non-trivial.. It looks like I need to do a http PUT with cart_item.quantity set to 0 to {% url 'shop:cart-detail' %} (+ /product.id) like this does:

// put a cart item into the watch list
$scope.watchCartItem = function(cart_item) {
	cart_item.quantity = 0;
	postCartItem(cart_item, 'PUT');
}

.. but I think it would be cleaner to handle this in the watch-list serializer keeping the angular code in catalog.js as-is, but I can't seem to find where in the code this is handled..

racitup avatar Nov 17 '16 20:11 racitup

If the product is already in the cart and the user presses Watch product, essentially nothing happens. I would expect the product to be removed from the cart and switched to the watch list (quantity = 0), as it does when you hit the Watch item button in the cart.

You mean, if you are on the detail view of a product page and click watch product, instead of buy product? Yes this is intentional. You can not have a product both in the cart, as well as in the watch-list. For me it is hard to imagine a valid and real world use-case for this, since it would confuse customers.

Something I agree on, is that a customer might want to remember stuff he bought. Here it might make sense to add a checkbox on each cart item labeled "Remember for next purchase". Then on checkout, those items would be re-added to the watch list.

jrief avatar Nov 18 '16 08:11 jrief

Yes detail view of product page and click watch product when the product is already in the cart. I absolutely agree the product shouldn't be in both watch list and cart at the same time (I like the quantity=0 solution), but I would expect the product to move from cart to watch list.

I don't think it's necessary to add such a checkbox: I would expect a customer to look back through their list of orders to remember what they bought. A related feature: I intend to implement mailing list subscriptions for products, and I think it would make sense to have a user checkbox for "items in the watch list" and "items I have purchased"

racitup avatar Nov 18 '16 15:11 racitup

I would expect a customer to look back through their list of orders to remember what they bought.

A checkbox to re-add items to the wish-list would make a lot of sense on each Detal Order View. It would be quite easy to implement.

What do you mean with "mailing list subscriptions for products"? How should that work?

jrief avatar Nov 22 '16 20:11 jrief

I've added two fields on the customer model:

subscription_newsletter = models.BooleanField(_("Subscribe to Newsletter"), default=False,
        help_text=_("Email subscription"))
subscription_watchlist_status = models.BooleanField(_("Subscribe to Product Status Changes"), default=False,
        help_text=_("Email subscription"))

The 2nd one I intend to use the customer's watch list as a subscription to individual product updates. As I said before, another one could be a subscription for "items I have purchased" which would get its data from the order history.

racitup avatar Nov 24 '16 04:11 racitup

This would be a great third party app for django-SHOP. Since the Customer model must be overridden anyway, one could use that from the app. Creating newslettes and sending them, could also be added to that app. An async trigger could compares the Cart's updated_at against the updated_at from products and then creates information emails for customers.

jrief avatar Nov 24 '16 07:11 jrief