I'm testing my Ubercart site and have added the Roles feature to a Product Kit-enabled product (i.e. when you purchase multiple products as a kit, you're assigned a role).

However this doesn't seem to work. When the order status gets changed to 'completed', the 'renew roles' conditional action is run (I know as I added a 'display message' action to it), but no roles are assigned.

To find out what the issue was, I started going through the uc_roles_action_order_renew() function, adding dpm()'s to see what was happening. It seems that when it loops through the order's products (foreach ($order->products as $product)), it get's the two individual product node ID's that make up the kit. But in the database, the role is attached to the kit's node ID and that's why it doesn't work.

As far as I can tell, this is a bug that should be fixable by simply adding another check to the aforementioned function that checks the product kit's node ID as well as the individual products that make up the kit...

#9 1029760-product-kit-disable-features.patch572 byteslongwave
PASSED: [[SimpleTest]]: [MySQL] 2,798 pass(es). View
Members fund testing for the Drupal project. Drupal Association Learn more


swarad07’s picture

Any leads on this. ?

longwave’s picture

I don't think this has ever worked. I guess it does make sense to allow roles to be attached to a kit rather than the individual products, but kits have to be dealt with as a special case in lots of parts of Ubercart.

TR’s picture

Version: 6.x-2.4 » 7.x-3.x-dev

Let's fix this in 7.x-3.x first.

Island Usurper’s picture

In order for this to work, for any product feature like files and roles, the feature has to be transferred from the kit node to one of the cart items. Product kits don't exist in the cart, so the features attached to it aren't ever seen by the checkout hooks.

TR’s picture

I think in the long run, this is something that will be addressed by #525612: Allow any node type to become a product. As a side effect, I think that issue obsoletes product kits, which become simply a node with two or more product references that's been turned into a product. Although I guess it also implies a computed price field (to calculate kit discount) rather than a fixed price field. A standard computed price field probably makes sense anyway because it would enable all sorts of other good things. I'm not a big fan of product kits because they address such a small use case. I would avoid building up too much infrastructure that is kit-specific, and avoid requiring modules like uc_roles to deal with kits differently than products.

sumitmadan’s picture

Version: 7.x-3.x-dev » 6.x-2.4

I have a problem on product kit it is not assigning the role i want.
Let me clear I want to create a package on more than one product for that I am assigning a diffrent role on feature option in edit of product-kit content type.But it is assigning the role of first product after completing the order.
Have you any solution of this problem???

TR’s picture

Version: 6.x-2.4 » 7.x-3.x-dev
longwave’s picture

Title: Roles not compatible with Product Kit » Roles and file downloads not compatible with Product Kit
longwave’s picture

Status: Active » Needs review
572 bytes
PASSED: [[SimpleTest]]: [MySQL] 2,798 pass(es). View

This trivial patch disables product features for product kits, as roles and file downloads will never work without significant code changes.

longwave’s picture

Status: Needs review » Fixed

Committed to both branches.

Status: Fixed » Closed (fixed)

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