Update product kit quantity when an identical one is added to the cart

Island Usurper - August 16, 2009 - 19:55
Project:Ubercart
Version:6.x-2.x-dev
Component:Code
Category:bug report
Priority:normal
Assigned:Island Usurper
Status:closed
Description

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

Island Usurper - August 16, 2009 - 19:56
AttachmentSize
550802_update_product_kits.patch 2.5 KB

#2

Island Usurper - October 20, 2009 - 20:01

Wow this is old, and needs a review. Rerolled.

AttachmentSize
550802_update_product_kits.patch 2.31 KB

#3

rszrama - October 20, 2009 - 20:04
Status:needs review» needs work

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

Island Usurper - October 20, 2009 - 20:28
Status:needs work» needs review

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

rszrama - October 21, 2009 - 19:31
Status:needs review» reviewed & tested by the community

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

Island Usurper - October 21, 2009 - 19:33
Status:reviewed & tested by the community» fixed

A-yup. Committed.

#7

System Message - November 4, 2009 - 19:40
Status:fixed» closed

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

 
 

Drupal is a registered trademark of Dries Buytaert.