Update product kit quantity when an identical one is added to the cart
| Project: | Ubercart |
| Version: | 6.x-2.x-dev |
| Component: | Code |
| Category: | bug report |
| Priority: | normal |
| Assigned: | Island Usurper |
| Status: | closed |
Since product kits are stored in the cart as its individual component items, these have to be kept separate from the other products that are added individually. Similarly, products with different attributes also have to be kept separate so that their quantities can be adjusted separately.
This makes product kits with attributes a hairy situation to deal with. Given the default setting, the customer can only see the whole product kit in their cart. If they adjust the quantity of it, or remove it from the cart, Ubercart has to figure out which individual products it should adjust or remove for them. For a while now, the solution has been to assign a unique id to each product kit that is added to the cart. This id is added to its products' data arrays, so they all know which specific product kit they belong to in the cart. However, this means that even identical product kits (same attribute options, etc.) are treated as different things by the cart, and that's a problem for stores with lots product kits, and lots of products in them.
This patch addresses this problem by looking harder at the items in the cart to see if there is an kit in it that is identical to the one that is being added.

#1
#2
Wow this is old, and needs a review. Rerolled.
#3
The patch doesn't quite work as advertised. For example, use this kit on the Livetest:
http://livetest.ubercart.org/uc2/advertisement
You'll notice that subsequent adds only increment the beanie's count and not the uberclub membership, so the Qty. in the textfield will still read 1 even as the component part gets its quantity updated.
#4
Interestingly, I can't duplicate that error on my own test site. I thought it might have been that the membership doesn't have any attributes, but I tried a similar kit and it still updated the quantities correctly.
Can anyone confirm this bug?
#5
Not sure what's up with the Livetest, but this patch worked just fine on my local test site. That was with a kit with two products with attributes and another kit with only one product with attributes. I guess commit this'n, eh?
#6
A-yup. Committed.
#7
Automatically closed -- issue fixed for 2 weeks with no activity.