I would like my users to be able to purchase userpoints, which they can use for things like featuring their posts, or accessing certain content. However, I've run into a little wall regarding the Userpoints Product feature. Basically, the problem is that you can only assign one points total per product, which makes it difficult to include multiple options, or use it as a subscription.

Using attributes, you can define certain features, and give them their own sky. This allows you to create something like this:

Options:
1 month subscription: $10, sku 1
6 month subscription: $40, sku 2
12 month subscription: $60, sku 3

With the ubercart role purchase feature, I can then set each sku to purchase a certain role for a certain amount of time, IE 1 month, 6 months, 1 year, etc. You can do this, because in the features section, you can select the sku for each role/time period. However there aren't really any similar options for the Userpoints Product feature. Which means that if people purchase a 1 month, 6 month, or 1 year subscription, they can still only get a certain amount of user points. It would be great if the userpoints product feature allowed you to select which sku you were assigning the points to, and therefore set totals of 100 points for a 1 month subscription, 600 points for a 6 month subscription, etc.

Has anyone figured out a way to do this, or is there perhaps a better way to handle subscriptions?

CommentFileSizeAuthor
#4 865694-attribute-points.patch6.1 KBrbayliss
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

NathanM’s picture

That should be sku instead of sky, by the way.

arivusudar.nc’s picture

Hi
Same thing above am trying. Please could you any body founded solution for this issue.

bmagistro’s picture

Category: support » feature
Status: Active » Postponed

Changing to feature request and marking postponed.

At present this isn't possible. I am going to put it on the D7 wish list when it gets started but for now the only way I can think of to accomplish this is not use product attributes and have each attribute be a product this way you could do what you are trying to. I know this could quadruple the number of products to manage and is not clean but it's all I can think of right now.

rbayliss’s picture

This patch depends on #1050366, but I think this solves the problem.

that0n3guy’s picture

#4 doesn't work.

The install needs an update:

function uc_userpoints_product_update_6100() {
  $ret = array();
  db_add_field($ret, 'uc_userpoints_products', 'oid', array('description' => t('TODO: please describe this field!'), 'type' => 'int', 'not null' => TRUE));
  return $ret;
}

and you call the funtion "uc_attribute_load_product_attributes" which does not exist and I think should be "uc_product_get_attributes" at line 77.

I will be testing this soon and will report back.

that0n3guy’s picture

Tested a little and seems to work well. I have an issue though and I don't know if #4 causes it or #1050366 causes it. But when using uc_userpoints_payment, the points no longer multiply by the quantity.

I've kinda started doing what I was doing a little bit differently so I reverted the patch and won't be doing any more testing on it right now, just an FYI.

ocamp’s picture

hey, have you got any further with this?

Basically im just trying to allow my users to buy different amount of user points but I dont want each amount to be a different product. - just one product where the user can select how many points they want to buy.

Is that what this discussion is trying to acheive?

Any advice/feedback is appreciated. Thanks