Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

### POINTS AND REWARDS MODULE V1.00 ###


Recommended Posts

I noticed two problems with this module and am wondering if there are fixes.

 

1. Points are not rounded so when I mark things on sale for 15% off I some times end up with fractions of points.

2. Points redemption seem to include the ability to pay shipping charges and the paypal payment gateway seems to have issues with this.

 

Please let me know!

 

Thanks,

-Chris

Link to comment
Share on other sites

Would like to return back to Tina's issue, quoted bellow. Indeed when using a single CC payment option or when the CC radio button is checked the CC error mesage is received even though Points very well cover the Total.

 

Was wondering if you (Tina) or anyone else found a fix :).

 

Arkady.

 

Thank you for your response, however I probably should have been a little more specific. The problem is occurring in checkout_payment.php before the customer ever gets to checkout_confirmation.php. If the individual does not enter credit card information, he or she receives an error and cannot leave the page, even though they have enough points to cover the order.

 

I believe the issue could have something to do with the fact we are using a single payment option. So if my understanding of the following code is correct, that single payment option is selected by default:

 

<?php
if (sizeof($selection) > 1) {
  echo tep_draw_radio_field('payment', $selection[$i]['id']);
} else {
  echo tep_draw_hidden_field('payment', $selection[$i]['id']);
}
?>

 

I did try an experiment by changing that code to if(sizeof($selection) > 0), which then forced a selection of the credit card if the customer chose to use one. That solved the problem of receiving errors of not entering credit card information. However it created an even worse problem in that ANY point value entered whether it covered the order total or not resulted in a successful purchase. :o

 

I have to believe that surely if no one else is experiencing this issue that I have something configured incorrectly. However at this point I am at a complete loss as to what that might be. I have double and triple checked the code per the instructions and even used a text compare utility and all appears correct there.

 

Tina

Edited by Voland

People dont change, people realize.

Link to comment
Share on other sites

I don't use cc soI can't really speculate or comment but can say that even if I leave the method of payment blank but use the max points checkbox or manually type in the amount of points, it doesn't ask me to select a method of payment.

 

Sorry

Upon receiving fixes and advice, too many people don't bother to post updates informing the forum of how it went. Until of course they need help again on other issues and they come running back!

 

Why receive the information you require in good faith for free, only to then have the attitude to ignore the people who gave it to you?

 

There's no harm in saying, 'Thanks, it worked'. On the contrary, it creates a better atmosphere.

 

CHOOCH

Link to comment
Share on other sites

I don't use cc soI can't really speculate or comment but can say that even if I leave the method of payment blank but use the max points checkbox or manually type in the amount of points, it doesn't ask me to select a method of payment.

 

Sorry

That's exactly the thing. If you have more then one payment modules enabled then once the customer gets to the checkout_payment.php those payment options are not selected by default; therefore if they have enough Points to cover Total and chose to use the Points they get passed to checkout_confirmation.php no problem. But if one of those payments is CC and it is selected (either manually or for any reason automatically) and no CC info is entered then they get the CC error message. That is also obviosly the case if you have only CC as a single payment option enabled, becasue then there is no radio button and as far as the system is concerend it is selected by default.

 

I was trying to figure out where it is that the single payment option is made selected by default but I can't so far. However I have mannaged to bring the radio button to the single payment option but again it comes up already selected. Still working on it to come up with some sort of acceptable fix. It's wilderness for me out there as I am not at all a programmer. :o

Edited by Voland

People dont change, people realize.

Link to comment
Share on other sites

Here is my progress so far on the above issue, any real programmers pretty please coment and correct if nessesarry:

 

To get the radio button to apear while having a single payment option in checkout_payment.php replace

if (sizeof($selection) > 1) {
  echo tep_draw_radio_field('payment', $selection[$i]['id']);
} else {
 echo tep_draw_hidden_field('payment', $selection[$i]['id']);
}

with

echo tep_draw_radio_field('payment', $selection[$i]['id']);

 

In other words remove the conditional all together and just bluntly place the radio button.

 

in the same file (checkout_payment.php) a little higher up find

if (sizeof($selection) > 1) {
?>
		  <tr>
			<td><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
			<td class="main" width="50%" valign="top"><?php echo TEXT_SELECT_PAYMENT_METHOD; ?></td>

and replace the

if (sizeof($selection) > 1) {

with

if (sizeof($selection) > 0) {

to get the whole "Please Select" thing present.

 

Problem is that the radio button apears CHECKED by default. I have isolated it to the following code in the functions/html_output.php

// Output a selection field - alias function for tep_draw_checkbox_field() and tep_draw_radio_field()
 function tep_draw_selection_field($name, $type, $value = '', $checked = false, $parameters = '') {
$selection = '<input type="' . tep_output_string($type) . '" name="' . tep_output_string($name) . '"';

if (tep_not_null($value)) $selection .= ' value="' . tep_output_string($value) . '"';


if ( ($checked == true) || ( isset($GLOBALS[$name]) && is_string($GLOBALS[$name]) && ( ($GLOBALS[$name] == 'on') || (isset($value) && (stripslashes($GLOBALS[$name]) == $value)) ) ) ) {
  $selection .= ' CHECKED';
}

if (tep_not_null($parameters)) $selection .= ' ' . $parameters;

$selection .= '>';

return $selection;
 }

////
// Output a form checkbox field
 function tep_draw_checkbox_field($name, $value = '', $checked = false, $parameters = '') {
return tep_draw_selection_field($name, 'checkbox', $value, $checked, $parameters);
 }

////
// Output a form radio field
 function tep_draw_radio_field($name, $value = '', $checked = false, $parameters = '') {
return tep_draw_selection_field($name, 'radio', $value, $checked, $parameters);
 }

I have no idea what any of those values and parameters mean in that first IF statement. I beleive that's where the mistery of the default CHECKED is h iding :)

 

Can someone help?

Edited by Voland

People dont change, people realize.

Link to comment
Share on other sites

Above I meant the

 if ( ($checked == true) || ( isset($GLOBALS[$name]) && is_string($GLOBALS[$name]) && ( ($GLOBALS[$name] == 'on') || (isset($value) && (stripslashes($GLOBALS[$name]) == $value)) ) ) ) {
  $selection .= ' CHECKED';
}

Apearantly one of those conditions is being met.

People dont change, people realize.

Link to comment
Share on other sites

Ofcourse it would be much nicer to just perform a check and if tehre are enough points let the customer through no matter what is checked or uncheked, like CCGV does. And so here is my fix. Again this is just my own trial and error so I am not sure how well this fits into t he coding rules of osC and/or security. I have CCGV so take taht into account.

 

There is a line in the checkout_confirmation.php created by CCGV(trad)

if ($credit_covers) $payment=''; // CCGV

Replace that line with

if (!$credit_covers && $customer_shopping_points_spending && tep_calc_shopping_pvalue($customer_shopping_points_spending) >= $order->info['total'] && !is_object($$payment)) $payment=''; // CCGV and Point/Rewards

The above code is taken from the follwing Points/Rewards line found further down in the same file

//force customers to select other payment method if the points total not enough to cover the cost.
  if ( !$credit_covers && $customer_shopping_points_spending && tep_calc_shopping_pvalue($customer_shopping_points_spending) < $order->info['total'] && !is_object($$payment)) {
	tep_redirect(tep_href_link(FILENAME_CHECKOUT_PAYMENT, 'error_message=' . urlencode(REDEEM_SYSTEM_ERROR_POINTS_NOT), 'SSL'));

All I did was change the < sign to >=.

 

Now there is also a

if ($credit_covers) $payment=''; // CCGV

in the checkout_process.php. I am not sure if the same amendment needs to be made there as well. FOr now I left it untouched, and teh whole thing seems to work; that is I get passed to checkout_confirmation.php if I have enough points regardless of whether any payment option is selected or payment info entered.

 

I supose people without CCGV can just use the Points/Rewards line refferenced above, just change the to >= and paste under "// load selected payment module"

 

Can somone more knoledgable then myself comment on all of this please?

 

Arkady

People dont change, people realize.

Link to comment
Share on other sites

Would like to return back to Tina's issue, quoted bellow. Indeed when using a single CC payment option or when the CC radio button is checked the CC error mesage is received even though Points very well cover the Total.

 

Was wondering if you (Tina) or anyone else found a fix :).

 

Arkady.

 

The code below is what I have managed to come up with so far. It remains in my test environment for the time being, however thus far appears to be functioning the way I would like for it to. Of course I am very concerned with security, so if there is a security flaw here please do point it out for me.

 

Starting at line 101 in my payment_confirmation.php file before my modification the code appeared like this:

 

// customer can't use points over the order total 		   
  if (tep_calc_shopping_pvalue($customer_shopping_points_spending) > $order->info['total']) {
	$customer_shopping_points_spending = 0;
	tep_redirect(tep_href_link(FILENAME_CHECKOUT_PAYMENT, 'error_message=' . urlencode(REDEEM_SYSTEM_ERROR_POINTS_OVER), 'SSL'));
  }
  } 
// if ( (is_array($payment_modules->modules)) && (sizeof($payment_modules->modules) > 1) && (!is_object($$payment)) && (!$credit_covers) ) {
  if ( (is_array($payment_modules->modules)) && (sizeof($payment_modules->modules) > 1) && (!is_object($$payment)) && (!$credit_covers) && (!$customer_shopping_points_spending) ) {
 tep_redirect(tep_href_link(FILENAME_CHECKOUT_PAYMENT, 'error_message=' . urlencode(ERROR_NO_PAYMENT_MODULE_SELECTED), 'SSL'));
  }

 

After the modification the same block of code looks like this:

// customer can't use points over the order total 		   
  if (tep_calc_shopping_pvalue($customer_shopping_points_spending) > $order->info['total']) {
	$customer_shopping_points_spending = 0;
	tep_redirect(tep_href_link(FILENAME_CHECKOUT_PAYMENT, 'error_message=' . urlencode(REDEEM_SYSTEM_ERROR_POINTS_OVER), 'SSL'));
  }

  //******* beginning of possible fix ************
  if (tep_calc_shopping_pvalue($customer_shopping_points_spending) == $order->info['total']){

	 $payment_modules = NULL;
  }
  //******* end of possible fix **********

 } 
// if ( (is_array($payment_modules->modules)) && (sizeof($payment_modules->modules) > 1) && (!is_object($$payment)) && (!$credit_covers) ) {
  if ( (is_array($payment_modules->modules)) && (sizeof($payment_modules->modules) > 1) && (!is_object($$payment)) && (!$credit_covers) && (!$customer_shopping_points_spending) ) {
 tep_redirect(tep_href_link(FILENAME_CHECKOUT_PAYMENT, 'error_message=' . urlencode(ERROR_NO_PAYMENT_MODULE_SELECTED), 'SSL'));
  }

 

Hopefully I've included enough code there so that it can be followed, without making this post too long.

 

The one thing that I discovered early in my attempts to resolve this and would like to know if others experience it as well. If I added an additional payment option and therefore required a customer to pick one in order that one be selected; If no payment option was selected and any amount at all entered in the points box, the errors went away a good thing, but also the order went directly to the success page even if the points were not enough to cover, a very bad thing :o

 

I would like to know if anyone trying the multiple payment option also has that experience or if it was just me.

 

I'll come back later and take a look at your code, allergies are kicking up today and have a pounding headache right now.

 

Be well,

Tina

If you're not having fun you're not doing it right

 

Teach a person to fish rather than give them a loaf of bread or however that saying goes.

Link to comment
Share on other sites

There is a line in the checkout_confirmation.php created by CCGV(trad)

if ($credit_covers) $payment=''; // CCGV

Replace that line with

if (!$credit_covers && $customer_shopping_points_spending && tep_calc_shopping_pvalue($customer_shopping_points_spending) >= $order->info['total'] && !is_object($$payment)) $payment=''; // CCGV and Point/Rewards

The above code is taken from the follwing Points/Rewards line found further down in the same file

//force customers to select other payment method if the points total not enough to cover the cost.
  if ( !$credit_covers && $customer_shopping_points_spending && tep_calc_shopping_pvalue($customer_shopping_points_spending) < $order->info['total'] && !is_object($$payment)) {
	tep_redirect(tep_href_link(FILENAME_CHECKOUT_PAYMENT, 'error_message=' . urlencode(REDEEM_SYSTEM_ERROR_POINTS_NOT), 'SSL'));

All I did was change the < sign to >=.

 

 

Arkady

 

I think what you have done here is similiar to my potential solution. What I found as the core of the problem is that most cc payment options call a pre-confirmation and confirmation functions. It is within those functions that the "misguided" errors are performed. If it were not for those two function calls there would likely not exist a problem. However when a cc is used they do perform a vital function.

 

So my thought process went along the lines of, if the cc is being used then call those functions, if it is not, then don't. What my code and your code likely does is blank out that cc payment object and therefore there are no functions available to call, and no error messages to display. That's my conclusion after a long weekend studying the process. I certainly welcome any corrections if I am wrong on anything.

 

BTW on your code I would probably change the >= to ==. Otherwise someone could spend over the required number of points.

 

Be well,

Tina

If you're not having fun you're not doing it right

 

Teach a person to fish rather than give them a loaf of bread or however that saying goes.

Link to comment
Share on other sites

//******* beginning of possible fix ************

if (tep_calc_shopping_pvalue($customer_shopping_points_spending) == $order->info['total']){

 

$payment_modules = NULL;

}

//******* end of possible fix **********

 

Hi Tina,

 

Well that looks pretty much like my sugestion. Only thing is you use == operator. However we want to not just check if the ammount of points is equal to but also if it's greater then, thus I used >=. But your fix usses the same logic as mine other then I incororated the fix into CCGV line of code.

 

Still a confirmation by a knolwegebly programmer needed. Is tehre anybody out there? :)

People dont change, people realize.

Link to comment
Share on other sites

So my thought process went along the lines of, if the cc is being used then call those functions, if it is not, then don't. What my code and your code likely does is blank out that cc payment object and therefore there are no functions available to call, and no error messages to display. That's my conclusion after a long weekend studying the process. I certainly welcome any corrections if I am wrong on anything.

Exactly .. that is what CCGV does at

if ($credit_covers) $payment=''

as I think you ve pointed out some time before.

 

BTW on your code I would probably change the >= to ==. Otherwise someone could spend over the required number of points.

Are you sure? I really dont think so, as this is only a conditional. Altough ill research that. If anything am under the impression if we use == then if the number of points is greater then (>), then the fix will only work in teh case of amount being exactly equal to. Ill have ot test it out :).

Edited by Voland

People dont change, people realize.

Link to comment
Share on other sites

Exactly .. that is what CCGV does at
if ($credit_covers) $payment=''

as I think you ve pointed out some time before.

Are you sure? I really dont think so, as this is only a conditional. Altough ill research that. If anything am under the impression if we use == then if the number of points is greater then (>), then the fix will only work in teh case of amount being exactly equal to. Ill have ot test it out :).

 

Within the code that is supplied for Points and Rewards is this block of code:

 

// customer can't use points over the order total 		   
  if (tep_calc_shopping_pvalue($customer_shopping_points_spending) > $order->info['total']) {
	$customer_shopping_points_spending = 0;
	tep_redirect(tep_href_link(FILENAME_CHECKOUT_PAYMENT, 'error_message=' . urlencode(REDEEM_SYSTEM_ERROR_POINTS_OVER), 'SSL'));
  }

 

This code performs a check and if the value of the points being spent are more than the total of the order, it returns an error. That is the reason I made the jump to checking for the value being equal and not greater than. Sorry I should have been more clear on that in my post.

 

Be well,

Tina

If you're not having fun you're not doing it right

 

Teach a person to fish rather than give them a loaf of bread or however that saying goes.

Link to comment
Share on other sites

Somebody did put up a link somewhere to a 'report' page but that only customer name and points remaining (I think). I searched the contributions but couldn't find it - maybe someone posted it in this thread some time back?

Upon receiving fixes and advice, too many people don't bother to post updates informing the forum of how it went. Until of course they need help again on other issues and they come running back!

 

Why receive the information you require in good faith for free, only to then have the attitude to ignore the people who gave it to you?

 

There's no harm in saying, 'Thanks, it worked'. On the contrary, it creates a better atmosphere.

 

CHOOCH

Link to comment
Share on other sites

Confused!

 

My originally edited checkout_confirmation.php is doing somethng weird. It keeps sending me back to checkout-payment.php with "error_message=REDEEM+POINTS+ERROR+%21+Points+value+can+not+be+over+the+total+value.+Please+Re+enter+points" message in the URL.

 

It started doing it all of a sudden. The POints info is Points : 117.00 Value:$23.40 and the Total is $10.42. That peice of code in the checkout_confirmation.php

// customer can't use points over the order total 		   
  if (tep_calc_shopping_pvalue($customer_shopping_points_spending) > $order->info['total']) {
	$customer_shopping_points_spending = 0;
	tep_redirect(tep_href_link(FILENAME_CHECKOUT_PAYMENT, 'error_message=' . urlencode(REDEEM_SYSTEM_ERROR_POINTS_OVER), 'SSL'));
  }

is doing that. But why?

Edited by Voland

People dont change, people realize.

Link to comment
Share on other sites

Confused!

 

My originally edited checkout_confirmation.php is doing somethng weird. It keeps sending me back to checkout-payment.php with "error_message=REDEEM+POINTS+ERROR+%21+Points+value+can+not+be+over+the+total+value.+Please+Re+enter+points" message in the URL.

 

It started doing it all of a sudden. The POints info is Points : 117.00 Value:$23.40 and the Total is $10.42. That peice of code in the checkout_confirmation.php

// customer can't use points over the order total 		   
  if (tep_calc_shopping_pvalue($customer_shopping_points_spending) > $order->info['total']) {
	$customer_shopping_points_spending = 0;
	tep_redirect(tep_href_link(FILENAME_CHECKOUT_PAYMENT, 'error_message=' . urlencode(REDEEM_SYSTEM_ERROR_POINTS_OVER), 'SSL'));
  }

is doing that. But why?

 

Pleeeease someone help. I am going nuts here :)

People dont change, people realize.

Link to comment
Share on other sites

I am still having the above problem.

 

HEre is what it sais in the checkout_payment.php inside the Points Redemption section:

 

You have 117.00 Shopping points with total worth $23.40.

The estimated total of your purchase is: $14.99 .

Enter the amount of Points you wish to spend : TEXTBOX

Or tick here to use Maximum Points allowed for this order. (74.95 points) -> CHECKBOX

 

I check the box click Continue and it returns me back to checkout_payment.php with the following message in the URL

 

error_message=REDEEM+POINTS+ERROR+%21+Points+value+can+not+be+over+the+total+value.+Please+Re+enter+points

 

I mean why does that // customer can't use points over the order total conditional gets met?

 

Anyone wishing can test it out for themselves at www.mindphantom.com the products are not real feel free to make accounts and orders.

People dont change, people realize.

Link to comment
Share on other sites

I am still having the above problem.

 

HEre is what it sais in the checkout_payment.php inside the Points Redemption section:

 

You have 117.00 Shopping points with total worth $23.40.

The estimated total of your purchase is: $14.99 .

Enter the amount of Points you wish to spend : TEXTBOX

Or tick here to use Maximum Points allowed for this order. (74.95 points) -> CHECKBOX

 

I check the box click Continue and it returns me back to checkout_payment.php with the following message in the URL

 

error_message=REDEEM+POINTS+ERROR+%21+Points+value+can+not+be+over+the+total+value.+Please+Re+enter+points

 

I mean why does that // customer can't use points over the order total conditional gets met?

 

Anyone wishing can test it out for themselves at www.mindphantom.com the products are not real feel free to make accounts and orders.

 

This is exactly the condition I was attempting to point out to you in my post yesterday. Scroll up a few entries and you should find your answer.

 

Be Well,

Tina

If you're not having fun you're not doing it right

 

Teach a person to fish rather than give them a loaf of bread or however that saying goes.

Link to comment
Share on other sites

This is exactly the condition I was attempting to point out to you in my post yesterday. Scroll up a few entries and you should find your answer.

 

Be Well,

Tina

Yep, I know :) ... I was going to aknowledge it but I got swomped by this weird behaivior. The thing is I rolled back to the original version of the file with original Points/Rewards code - without the fix. And it is still doing it. I am completely and utterly confused ... becasue teh value of the points are not OVER the Total.

 

Also as far a as the code goes I wanted to clerify the difference between the following 2 variables

$customer_shopping_points_spending

and

$customer_shopping_points

Am I right to assume that the first corresponds to the Points dollar value being sent to checkout_confirmation.php (ex: whatever's entered in the tex feild); and the second is the customer's total Points dollar amount?

Edited by Voland

People dont change, people realize.

Link to comment
Share on other sites

I am looking for a small hack to this great contribution... :thumbsup:

 

I would like to show clients the points earned with current purchase during checkout process (at least on checkout_confirmation.php page).

 

It should look stg. like this

Order total: $7.551

S&P: $600

Tax 8,5%: $47

Tax 20%: $1.259

to PAY: $8.151

POINTS EARNED: 755

 

It would be good to see this also in Shopping Cart :-"

 

Tnx

Link to comment
Share on other sites

I am looking for a small hack to this great contribution...

 

I would like to show clients the points earned with current purchase during checkout process (at least on checkout_confirmation.php page).

It would be good to see this also in Shopping Cart :-"

 

Tnx

The call is in so many files why don't ypu just copy and paste it?

Upon receiving fixes and advice, too many people don't bother to post updates informing the forum of how it went. Until of course they need help again on other issues and they come running back!

 

Why receive the information you require in good faith for free, only to then have the attitude to ignore the people who gave it to you?

 

There's no harm in saying, 'Thanks, it worked'. On the contrary, it creates a better atmosphere.

 

CHOOCH

Link to comment
Share on other sites

The call is in so many files why don't ypu just copy and paste it?

 

I have looked and tried but withoud any success. :blush:

 

I have no problem adding clients total points to spend (this is in many files). These are the points he allready has from previous orders (he can spend this points at checkout).

 

What I am looking for is how to show the points that will be awarded to the client if he completes the order.

 

These are the point shown on product_info.php by:

echo sprintf(TEXT_PRODUCT_POINTS , 2*$products_points);

echo TEXT_PRODUCT_POINTS_VALUE . $currencies->format($products_points_value);

 

But I want them shown on checkout_confirmation.php...

 

I am sure it's simple and I am just dumb :blink: , but an example would still be great.

I would also like to show these points in "shopping cart box" instead of remaining points from previous orders.

 

Tnx in advance

Link to comment
Share on other sites

ATTN:

Anyone that will test the points system and make a false order on my real site other then the demo site will be banned forever with no support at the forum.

all test should be made ONLY on the demo site

http://www.deep-silver.com/shop/

 

and not the main url.

This is a real shop so do not setup account or/and make false order.

Remember - - - "STRESSED" spelled backwards "DESSERTS"

Link to comment
Share on other sites

ATTN:

Anyone that will test the points system and make a false order on my real site other then the demo site will be banned forever with no support at the forum.

all test should be made ONLY on the demo site

http://www.deep-silver.com/shop/

 

and not the main url.

This is a real shop so do not setup account or/and make false order.

How rude of them. I bet they would not like it to happen to them.

Link to comment
Share on other sites

I am still having the above problem.

 

HEre is what it sais in the checkout_payment.php inside the Points Redemption section:

 

You have 117.00 Shopping points with total worth $23.40.

The estimated total of your purchase is: $14.99 .

Enter the amount of Points you wish to spend : TEXTBOX

Or tick here to use Maximum Points allowed for this order. (74.95 points) -> CHECKBOX

 

I check the box click Continue and it returns me back to checkout_payment.php with the following message in the URL

 

error_message=REDEEM+POINTS+ERROR+%21+Points+value+can+not+be+over+the+total+value.+Please+Re+enter+points

 

I mean why does that // customer can't use points over the order total conditional gets met?

 

Anyone wishing can test it out for themselves at www.mindphantom.com the products are not real feel free to make accounts and orders.

Deep-Silver, can you give me a hint on how to fix my problem please. :(

People dont change, people realize.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...