Download & Extend

userpoints_ecommerce price/points multiplier only takes integers.

Project:User Points Contributed modules
Version:5.x-3.x-dev
Component:Code: userpoints_ecommerce
Category:bug report
Priority:normal
Assigned:Unassigned
Status:closed (won't fix)

Issue Summary

userpoints_ecommerce price/points multiplier only takes integers.

I noticed a issue (not sure if this is a bug or just a functionality difference) in userpoints_ecommerce_ecommerceapi method. On line 81 the multiplier variable is initialized as a integer. Therefore if you have the multiplier set to something like "0.1" it will register as 0, causing no points to be awarded even when the cost of the product is 10 (In this example one would expect 1 point per $10 in transactions).

Solutions:
A-
In the userpoints_ecommerce settings, make it clear that only whole numbers can be used, make sure that integers are not saved.
or B-
change line 81 to

<?php
$multiplier
= (float)variable_get(USERPOINTS_EC_EARN, 0);
?>

so that the multiplier can be a decimal value.

This is what I needed in my example because I want each point to cost $10, this may not be a safe way of doing this for other users, who may not be careful enough to make sure that only whole number points are awarded. (I'm sure users have .1 points would get confusing.)

Please advise

Also if solution B is chosen, be advised that in line 132, the userpoints_ecommerce_paymentapi, there is another multiplier that is also read as a integer. The same 2 solutions I proposed above should also work here.

Comments

#1

Status:needs work» closed (won't fix)

Sorry for pinging the participants.

Now that Drupal 7 is out, there is no support for Drupal 5 and the
corresponding modules anymore. Therefore, I'm closing all old issues
which are still open.

I suggest you upgrade to Drupal 6 or 7 and figure out if you're feature
is still needed or the bug still exists and open a new issue in that
case.