When using cart/add/ to add a product already in the cart, the item isn't added again, but the quantity set.

Attached patch changes this.

Comments

gordon’s picture

Status: Active » Needs review

lets get this tested.

gordon’s picture

Version: 6.x-4.0-rc15 » 6.x-4.x-dev

Status: Needs review » Needs work

The last submitted patch, cart_add.patch, failed testing.

gordon’s picture

Status: Needs work » Needs review
StatusFileSize
new1.38 KB

Re-roll for the latest dev version

gordon’s picture

Status: Needs review » Needs work

This is how the cart has always worked in that it has been a setting of the value.

I am wondering if we should go away from this completely and change it to use so that it will accept both methods.

I am thinking that we could use +1 instead of just 1 and then we could do things like a -1, or +5 or even =10 for setting the cart to 10 items.

Then we could add a setting which to determine what the default will be so people can choose how a 1 can work to either be a = or a +

xen’s picture

It doesn't make sense that the 'add to cart' button sets the value. I believe that the majority of webshops adds an item instead of setting a new value.

I'm all for a +/-/= feature, it makes it easy to implement alternatives, but my opinion is to make the default add, and not adding it as an option.

gordon’s picture

What I am saying is to make the default a parameter, so we can have the current method or we can change it to a different method.

xen’s picture

I'm not sure I'm not missing the point, but what I'm trying to say is that I like the idea of the cart/add callback supporting both adding and setting, but that my personal opinion is that, as long as the default button is called 'add to cart', that it should do a +1. I might be wrong, but it's my impression that the way it 'usually work on the net'. And that it makes sense for eC to decide for the user that thats the most sensible way to do it (again, IMHO). But if one where to override the default button with, say, a 'X of these in your basket', another behavior would make sense.

gordon’s picture

Status: Needs work » Fixed

Yes I see your point.

I have now committed this, but I would like to look in the future at changing cart/add to cart/[nid]/+1 instead so we can make a more generic provider for making it easier to build an interface on to of the cart system.

Thanks @Xen

xen’s picture

It would be nice to get into 4.0.

I've created #783790: Change cart to use cart/<nid>/+1 and assigned myself. I'm a bit hung up at the moment, but I'll see if I can't find some time.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.