I'm looking to use Userpoints Seller Points to help us track sales per contributor in a site that will have a number of people selling files.

One concern I have, however, is that it doesn't look to me like the module takes into account attributes and options. Here's the function that calculates the points:

/* ************************************************************************* *
 *  Workflow-ng Action Callbacks and Forms                                   *
 * ************************************************************************* */

function uc_userpoints_seller_award_points($order, $settings) {
  if (is_array($order->products)) {
    foreach ($order->products as $product) {
			$product_info = db_fetch_object(db_query("select n.uid from {node} n, {uc_products} p where n.vid = p.vid and p.model =  '%s'", $product->model));
			$total = (intval($product->qty) * intval($product->price));
			$multiplier = variable_get(UC_USERPOINTS_SELLER_EARN, 0);
		  $points = intval(($total * $multiplier));
			$blnDisplay = variable_get(UC_USERPOINTS_SELLER_DISP, 0);
			
			if ($points > 0) {
				$params = array (
					'tid' => 0,
					'uid' => $product_info->uid,
					'points' => $points,
					'operation' => 'insert',
					'description' => 'Someone purchased a product belonging to ' . $product_info->uid . ', awarding points (Ubercart Order ID ' . $order->order_id . ')',
//					'entity_id' => $order->order_id,
//					'entity_type' => 'Ubercart Transaction',
					'display' => $blnDisplay,
				);
				$st = userpoints_userpointsapi($params);
			  db_query("insert into {uc_up_seller_log} (uid, oid, points, qty, model, sellprice) values(%d, %d, %d, %d, '%s', %d)", $product_info->uid, $order->order_id, $points, $product->qty, $product->model, $product->price);
			}
			$total = '';
			$multiplier = '';
			$points = '';
    }
  }
}

Notice that for price it just looks up the default price for the product. Shouldn't this factor in price adjustments based on any options chosen?

Comments

mandclu’s picture

Status: Active » Closed (fixed)

Sorry, looking closer at the code I don't think this should be an issue.