It's not a bug, but something I want to describe.

I have a project with paid membership on the base of uc_roles and uc_recurring modules.

And suddenly UC role assignment functionality stopped working.
As I figure out later - it was because SKU had changed.

The issue is that uc_role feature is connected to product by product SKU - not product nid.
And after SKU is changed the connection will be lost.

Solution is - go to edit product -> 'Features' ->'Role assignment' ->'edit' and save new SKU here.

Comments

tr’s picture

Version: 6.x-2.0 » 7.x-3.x-dev
Category: bug » task

The issue is that uc_role feature is connected to product by product SKU - not product nid.
And after SKU is changed the connection will be lost.

A role assignment *cannot* be associated with a nid, because a nid may have many SKUs, not just one. So it is appropriate to use SKU as the "key" here. The problem comes in that there is no way for modules like uc_roles to be notified when a SKU changes. To fix this would require some architectural changes.

Thus, I'm going to move this to the 7.x issue queue so it can be considered as we develop the next version of Ubercart.

(This issue probably also applies to file access granted by uc_file ...)

Thanks for bringing this to our attention.

AlexisWilke’s picture

TR,

I have been wondering about that... When you say: "[one] nid may have many SKUs", are you referencing Product Kits? Or do you mean that any one Product can have multiple SKUs?

So far, I have not seen even one remote case in all my testing where I could enter more than one SKU on a node...

Thank you.
Alexis

tr’s picture

A product that has attributes can have a SKU assigned to each different attribute, by using the Adjustments tab. This allows you to have one product for a music CD with different attributes (and different SKUs) to specify a physical CD or file download. The file download can be assigned to just one of the SKUs. The same is true for roles. You grant a role for a specific SKU, which can be associated with a particular combination of attributes. Maybe you have three "membership" levels you want to sell: Gold, Silver, Platinum, each with its own role and each with a different price. You can use the Adjustments tab to set distinct prices and SKUs for each attribute and sell the roles separately according to the SKU, even though they are attributes of the same nid. When you add a new role to the product in the Features tab it will let you specify which SKUs are associated with that role.

longwave’s picture

Status: Active » Closed (works as designed)

Features are also assigned by nid if you select "any" SKU, and changing SKUs is a rare operation that is likely to have knock-on effects elsewhere, so I think this can be counted as "works as designed".