uc_userpoints_product module does not add points correctly

christiaan_ - May 21, 2009 - 13:02
Project:Ubercart Userpoints
Version:5.x-2.x-dev
Component:Code
Category:bug report
Priority:critical
Assigned:Unassigned
Status:closed
Description

uc_userpoints_product module does not add points correctly on orders with multiple products containing userpoints, when the order is completed.

I created various products with different points values. If I purchased more than one product with different points values assigned to each, the calucation was incorrect and the user was awarded the incorrect number of points.

For example : 5+10 points = 105 points

changed line 95 :

$totalPoints .= ($product->qty * $points); // Make sure we account for multiple qty of the Points product

to the following :

$totalPoints = $totalPoints + ($product->qty * $points); // Make sure we account for multiple qty of the Points product

and now the calucations are done correctly

Many thanks for a great module.

#1

bmagistro - May 21, 2009 - 13:26
Status:active» fixed

thanks for pointing that out. I fixed it differently in the dev. The line now reads as

$totalPoints += ($product->qty * $points); // Make sure we account for multiple qty of the Points product

the .= means concatenate which is what it did in your example except it would have been read as 510 (5 + 10). The += as it looks is addition.

#2

System Message - June 4, 2009 - 13:30
Status:fixed» closed

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

 
 

Drupal is a registered trademark of Dries Buytaert.