Is it possible to pay partial of the total by userpoints?

hankliu - August 31, 2008 - 09:45
Project:Ubercart Userpoints
Version:5.x-2.2
Component:User interface
Category:support request
Priority:normal
Assigned:bmagistro
Status:closed
Description

First of all thanks for such a great module. I am just wondering if it is possible to pay partial of the total by user points. I would like to let the user specify how much he would like to pay by his points, and the rest will be paid by whatever else payment method he selects. I think this is a very useful feature as a customer might never accumulate enough points to buy a product. On the other hand, it would be perfect if there is an option for admin to setup a threshold point level for point payment, which means, a customer can only pay by points when his number of points exceeds the threshold. Please let me know if I miss something that already exists in this module. Thanks again.

#1

bmagistro - August 31, 2008 - 12:37
Assigned to:Anonymous» bmagistro

This is currently available but I do not think I have a threshold setup like you are describing there. This functionality is provided by ubercart userpoints discounts. You will need to install userpoints, install my module and enable base userpoints and userpoints ubercart discounts. Outside of that, there should be very little you need to do besides set how many points a dollar is worth.

#2

hankliu - August 31, 2008 - 19:57

Thanks for the quick reply! I thought the discount module is for giving discounts based on point levels. It works now. However I found another problem: a user can pay by points even when he/she doesn't have enough points (This happens for both pay by point and point as discount). After payment the user's point became negative. Is it easy to fix this? Thanks again!

#3

bmagistro - August 31, 2008 - 20:35

what version are you using? that was a previous issue that should have been resolved two versions ago...

#4

hankliu - August 31, 2008 - 21:08

I see. I thought I was using 2.2 but I found I am using 1.9 instead, possibly because I saw it "Recommended for 5.x". In that case I will just switch to 2.2.

Also I am thinking of hard-coding the threshold function I mentioned earlier, below is the code I am trying to apply to uc_cart\uc_cart.module file within the uc_cart_checkout() function, but I don't really know how to find if the user selected pay by point or the user entered a value for point discount. Would you please give a hint?

if (user selected pay by point || user entered a value for point discount)  // This is the part I don't know how to deal with
{
  if ($current_userpoints < $threshold) {
  drupal_set_message(t('You need at least ' . $threshold . ' to pay by points and you have only ' . $current_userpoints), 'error');
  drupal_goto('cart/checkout');
  }
}

I really appreciate your quick response and thanks again for such a great module!

#5

bmagistro - September 1, 2008 - 01:13

First, do not modify uc_cart.module. That will make it very difficult to upgrade ubercart down the road. Instead modify the uc_userpoints_discounts.module file. I have some checks in there for how many points they have. You would code the thresh hold there for the discount function. for the payment one it is in uc_userpoitns_payment.module there should be a check there to see if they have any points you can just modify it there. please post back what changes you make. I may tweak them and put them into the module for others.

I think it still recommends 1.9 because I haven't heard from too many people on the 2.x series

#6

hankliu - September 1, 2008 - 23:06

Hi, before getting into that, I found that after upgrading to version 2.2 user can still pay by points even if he/she does not have enough points. Did I miss anything again? Thanks

#7

bmagistro - September 2, 2008 - 00:10

Did you completely uninstall the 1.x release and delete the files from your site before installing version 2.x? The files and components changed. The database structure remained the same as I recall. I would check that the 1.x files had been deleted.

This should be the previous issue regarding the balance not being checked. The important part for you begins at #18
http://drupal.org/node/254785

#8

hankliu - September 2, 2008 - 00:13

I did delete all the files then upload new files and run update. But I thought maybe I should disable and uninstall 1.x first before deleting it?

#9

bmagistro - September 2, 2008 - 00:18

Deleting the old files should have been enough. You can check the code in the files for the int() function which should be intval(). I will have to do some checking tomorrow.

#10

elvis2 - September 14, 2008 - 17:22

@hankliu, Can you update the status of this issue for us?

Regards

#11

bmagistro - November 16, 2008 - 20:33

What is the status of this issue?

#12

bmagistro - May 10, 2009 - 13:14
Status:active» closed

Closing due to a lack of response.

 
 

Drupal is a registered trademark of Dries Buytaert.