Jump to content
deep-silver

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

Recommended Posts

Question ...

 

I am on my way to installing; and am a little confused about the instructions for editing catalog/checkout_confirmation.php for CCGV.

 

Instruction say:

 

----------

To users with Credit Class & Gift Voucher contribution try using this line

 

Replace your line that start with....

if ( (is_array($payment_modules->modules)) && (sizeof($payment_modules->modules) > 1) && (!is_object($$payment)) && (!$credit_covers) ) {

 

with this ...

-----------------

 

Now do I replace only that line (which is there by CCVG)? Or do I replace both of teh following lines:

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

 

I ask since instructions for unmodified instalations tell to replace that second line along with the first (unmodified) line.

 

I am not a programmer and so unable to read teh logic of the code to figure this one out. Please help :)

 

Arkady


People dont change, people realize.

Share this post


Link to post
Share on other sites
Question ...

 

I am on my way to installing; and am a little confused about the instructions for editing catalog/checkout_confirmation.php for CCGV.

 

Instruction say:

 

----------

To users with Credit Class & Gift Voucher contribution try using this line

 

Replace your line that start with....

if ( (is_array($payment_modules->modules)) && (sizeof($payment_modules->modules) > 1) && (!is_object($$payment)) && (!$credit_covers) ) {

 

with this ...

-----------------

 

Now do I replace only that line (which is there by CCVG)? Or do I replace both of teh following lines:

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

 

I ask since instructions for unmodified instalations tell to replace that second line along with the first (unmodified) line.

 

I am not a programmer and so unable to read teh logic of the code to figure this one out. Please help :)

 

Arkady

 

Hello Arkady,

 

You would replace both lines. The "second line" is the rest of the if statement that is begun with the "first line". Of course you want to do back ups of any files that you have changed, just in case.

 

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.

Share this post


Link to post
Share on other sites
You would replace both lines. The "second line" is the rest of the if statement that is begun with the "first line".

That's what I thought Tina, but I decided to be a pest and make sure anyway. Better safe then sorry - scarry error messages keep me up at night :-" .

 

Thank you

 

Arkady

Edited by Voland

People dont change, people realize.

Share this post


Link to post
Share on other sites

I think I've taken myself on a wild goose chase. I have been over the Points and Rewards code line by line all day and I am unable to find anything that causes the checkout process to bypass the credit card processing if the points being redeemed are equal to the invoice balance.

 

For example its fairly easy to spot where this occurs in the code for Gift Vouchers:

 

if ($credit_covers) $payment=''; //ICW added 
 $payment_modules = new payment($payment);

 

However for Points and Rewards I am unable to find anything that performs this type of check. My conclusion is that the module does not support this functionality. Please do correct me if I am wrong.

 

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.

Share this post


Link to post
Share on other sites
That's what I thought Tina, but I decided to be a pest and make sure anyway. Better safe then sorry - scarry error messages keep me up at night :-" .

 

Thank you

 

Arkady

 

I know exactly what you mean :)

 

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.

Share this post


Link to post
Share on other sites

Hello all!

 

Just finished the Instalation. Getting teh folowing Error message:

 

Parse error: parse error, unexpected T_CASE in /home/mindphan/public_html/shop/admin/orders.php on line 127

 

while accessing admin/orders.php

 

The code on line 127 is this:

case 'deleteconfirm':
	$oID = tep_db_prepare_input($HTTP_GET_VARS['oID']);

 

The block of code around it is this (lines 114-135) right after the end of coded added by Points/Rewards Module V1.60:

tep_db_query("insert into " . TABLE_ORDERS_STATUS_HISTORY . " (orders_id, orders_status_id, date_added, customer_notified, comments) values ('" . (int)$oID . "', '" . tep_db_input($status) . "', now(), '" . tep_db_input($customer_notified) . "', '" . tep_db_input($comments)  . "')");

	  $order_updated = true;
	}

	if ($order_updated == true) {
	 $messageStack->add_session(SUCCESS_ORDER_UPDATED, 'success');
	} else {
	  $messageStack->add_session(WARNING_ORDER_NOT_UPDATED, 'warning');
	}

	tep_redirect(tep_href_link(FILENAME_ORDERS, tep_get_all_get_params(array('action')) . 'action=edit'));
	break;
  case 'deleteconfirm':
	$oID = tep_db_prepare_input($HTTP_GET_VARS['oID']);

	tep_remove_order($oID, $HTTP_POST_VARS['restock']);

	tep_redirect(tep_href_link(FILENAME_ORDERS, tep_get_all_get_params(array('oID', 'action'))));
	break;
}
 }

 

What is a T_CASE anyhow?


People dont change, people realize.

Share this post


Link to post
Share on other sites

Ok I ve done a qucik research. Apearntly it has to do something with the wrong number of closing "}". Im guessing die to the fact that the file was prefiosly modified by Order Editor contribution. I have tried tracking all the opening and closing brackets with my eyes, but I get lost in that "wilderness" :). I have tried removing the very last } from the block of code added by Points/Rewards Module, and I also tried removing one from under $order_updated = true; in the above code. Both work actually. I mean at least the interface loads, my concern is the functionality. WHich one should I remove out of those 2?

Edited by Voland

People dont change, people realize.

Share this post


Link to post
Share on other sites

Actually ... I have just counted the opening brackets Vs closing ones in the code block added by Points/Rewards Module and there seems to be an extra closing bracket - 10 Vs 11 (correct me if I'm wrong please). Did any one else get that Parse error?

Edited by Voland

People dont change, people realize.

Share this post


Link to post
Share on other sites
Actually ... I have just counted the opening brackets Vs closing ones in the code block added by Points/Rewards Module and there seems to be an extra closing bracket - 10 Vs 11 (correct me if I'm wrong please). Did any one else get that Parse error?

 

When you receive an unexpected T_CASE error it usually means that you have a situation where the CASE statement was ended before it was actually supposed to end, which is normally due to a misplaced extra end bracket. So you are somewhat on the right path.

 

When I look at your code and compare to what we have here, it looks to me as though you might have things a little bit mixed up. Your post says that immediately following the end of the Points mod you have:

 

tep_db_query("insert into " . TABLE_ORDERS_STATUS_HISTORY . " (orders_id, orders_status_id, date_added, customer_notified, comments) values ('" . (int)$oID . "', '" . tep_db_input($status) . "', now(), '" . tep_db_input($customer_notified) . "', '" . tep_db_input($comments)  . "')");

	  $order_updated = true;
	}

 

That particular block of code is actually near the beginning of my Points mod section. So maybe you have it in your code twice? The first few lines after my Points mod section are:

 

if ($order_updated == true) {
	 $messageStack->add_session(SUCCESS_ORDER_UPDATED, 'success');
	} else {
	  $messageStack->add_session(WARNING_ORDER_NOT_UPDATED, 'warning');
	}

 

You might try commenting out the section between the end of your Points mod section and the above code and see what happens.

 

Now I don't suppose you have a solution for my problem do ya? :)

 

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.

Share this post


Link to post
Share on other sites
I think I've taken myself on a wild goose chase. I have been over the Points and Rewards code line by line all day and I am unable to find anything that causes the checkout process to bypass the credit card processing if the points being redeemed are equal to the invoice balance.

 

For example its fairly easy to spot where this occurs in the code for Gift Vouchers:

 

if ($credit_covers) $payment=''; //ICW added 
 $payment_modules = new payment($payment);

 

However for Points and Rewards I am unable to find anything that performs this type of check. My conclusion is that the module does not support this functionality. Please do correct me if I am wrong.

 

Be well,

Tina

you can try to add this

  if ($customer_shopping_points_spending) $payment=''; //Points/Rewards Module V1.60

after

if ($credit_covers) $payment=''; //ICW added

but its creat a security hole even without adding this line and using only the CGV line as its bypass the payment method and relays on the code found in each payment method order total. this is not good becouse some time the customer can go truogh and even if not he will have to use the browser back button to go back and fix the change and this will couse scriping error in both php and java history.

so i gusse that my advice to you his to have one more payment method even if its just there and nobody use it or have one payment but not credit card, you should remember that the credit card is almost the only mode that check for errors when still in payment page.


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

Share this post


Link to post
Share on other sites
you can try to add this
  if ($customer_shopping_points_spending) $payment=''; //Points/Rewards Module V1.60

after

if ($credit_covers) $payment=''; //ICW added

but its creat a security hole even without adding this line and using only the CGV line as its bypass the payment method and relays on the code found in each payment method order total. this is not good becouse some time the customer can go truogh and even if not he will have to use the browser back button to go back and fix the change and this will couse scriping error in both php and java history.

so i gusse that my advice to you his to have one more payment method even if its just there and nobody use it or have one payment but not credit card, you should remember that the credit card is almost the only mode that check for errors when still in payment page.

 

I'm still not quite sure having multiple payment options would resolve the problem, as from my earlier tests that seemed to leave the system wide open, if a customer entered any amount at all it seems the order would go through with no checks.

 

What about adding something like this inside the if (USE_REDEEM_SYSTEM == 'true') section:

 

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

 

It seems that would accomplish something similiar to method Gift Voucher uses by checking to ensure the number of valid points indeed are equal to the invoice balance. Am I getting warm?

 

Thanks for your reply,

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.

Share this post


Link to post
Share on other sites
I'm still not quite sure having multiple payment options would resolve the problem, as from my earlier tests that seemed to leave the system wide open, if a customer entered any amount at all it seems the order would go through with no checks.

 

Was there not a fix for this issue some where in the forum before?

 

I am sure there was a fix posted somewhere about how to get the checkout to stop askign for cc details if a single payment module was used and the points were the equivalent of the final cost. Try searching the payment modules (cc) for updates, I'll see if I can find it too.


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

Share this post


Link to post
Share on other sites
Was there not a fix for this issue some where in the forum before?

 

I am sure there was a fix posted somewhere about how to get the checkout to stop askign for cc details if a single payment module was used and the points were the equivalent of the final cost. Try searching the payment modules (cc) for updates, I'll see if I can find it too.

 

Thanks Chooch,

 

I did search through this topic and did not find anything. Of course there are over 900 posts so its possible if its there I may have missed it. So I will do some more searching. Thanks for the advice.

 

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.

Share this post


Link to post
Share on other sites

I was refering to order totals in general using cc, not necessarily in this post... I'll keep looking when I get a chance.


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

Share this post


Link to post
Share on other sites

Hi...I've got few questions here.

 

I'm using MVS for my store as well.From my observation,the Points/Rewards script is calculate points from shipping cost too,eventhough i've already disable it from admin (configuration).

 

Can anyone solve my problem?Should i edit something?

Share this post


Link to post
Share on other sites
tina_boots: Now I don't suppose you have a solution for my problem do ya?

 

Well I am in the process of rigorously testing all my so far installed contributions (which is 3 Order Editor, CCGV, P&R - in that order), with various scenarios. And so your problem became a concern to me since indeed it is very possible that some customer swill collect enough points to cover their order or 2. However I am not expereincing what you described. Here is the behaivor on my end: When I (posing as customer) get to the checkout_payment.php and check the "...Maximum Points allowed for this order" box and do NOT choose any of the payment methods listed, the process easely passes me onto the checkout_confirmation.php where I can see a summery of the charges including the Points discount. As long as I do not have both the checkbox ticked and a value entered into the Points amount textBox - only one should be used.

Edited by Voland

People dont change, people realize.

Share this post


Link to post
Share on other sites
When you receive an unexpected T_CASE error it usually means that you have a situation where the CASE statement was ended before it was actually supposed to end, which is normally due to a misplaced extra end bracket. So you are somewhat on the right path.

 

When I look at your code and compare to what we have here, it looks to me as though you might have things a little bit mixed up. Your post says that immediately following the end of the Points mod you have:

 

tep_db_query("insert into " . TABLE_ORDERS_STATUS_HISTORY . " (orders_id, orders_status_id, date_added, customer_notified, comments) values ('" . (int)$oID . "', '" . tep_db_input($status) . "', now(), '" . tep_db_input($customer_notified) . "', '" . tep_db_input($comments)  . "')");

	  $order_updated = true;
	}

 

That particular block of code is actually near the beginning of my Points mod section. So maybe you have it in your code twice? The first few lines after my Points mod section are:

 

if ($order_updated == true) {
	 $messageStack->add_session(SUCCESS_ORDER_UPDATED, 'success');
	} else {
	  $messageStack->add_session(WARNING_ORDER_NOT_UPDATED, 'warning');
	}

 

You might try commenting out the section between the end of your Points mod section and the above code and see what happens.

 

Now I don't suppose you have a solution for my problem do ya? :)

 

Be well,

Tina

I am not sure what you mean. I mean I have followed the instructions down to the line while manually modifying files. The instructions go liek this:

 

ADMIN STEP = 1. open admin/orders.php

This will add a quick pending points conformation check box.

To be used when confirming order or updating order status.

This option will only show up when there are pending points for that order

and only if Auto Credit Pending Points is set to "false".

 

Find... (start at aprox. line 54)

 

$customer_notified = '1';

}

 

... and add after.....

 

######## Points/Rewards Module V1.60 BOF ##################

code

######## Points/Rewards Module V1.60 EOF ##################

 

So I found that peice of code:

 

tep_mail($check_status['customers_name'], $check_status['customers_email_address'], EMAIL_TEXT_SUBJECT, $email, STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS);

		$customer_notified = '1';
######## Points/Rewards Module V1.60 BOF ##################
code
######## Points/Rewards Module V1.60 EOF ##################[/i]

 tep_db_query("insert into " . TABLE_ORDERS_STATUS_HISTORY . " (orders_id, orders_status_id, date_added, customer_notified, comments) values ('" . (int)$oID . "', '" . tep_db_input($status) . "', now(), '" . tep_db_input($customer_notified) . "', '" . tep_db_input($comments)  . "')");

	  $order_updated = true;
	} 

	if ($order_updated == true) {
	 $messageStack->add_session(SUCCESS_ORDER_UPDATED, 'success');
	} else {
	  $messageStack->add_session(WARNING_ORDER_NOT_UPDATED, 'warning');
	}

	tep_redirect(tep_href_link(FILENAME_ORDERS, tep_get_all_get_params(array('action')) . 'action=edit'));
	break;
Line 127 - case 'deleteconfirm':
	$oID = tep_db_prepare_input($HTTP_GET_VARS['oID']);

	tep_remove_order($oID, $HTTP_POST_VARS['restock']);

	tep_redirect(tep_href_link(FILENAME_ORDERS, tep_get_all_get_params(array('oID', 'action'))));
	break;
}
 }

 

So what does it mean when you say that teh CASE stement was ended before it was suposed to? WHat is the indicator of where and how it ends?

 

The thing is that for now I belive that I have fixed the problem by removing the last end-bracket from the Points/Rewards block. But I am afraid that might be only a quick fix and might give trouble down the road.

 

Id also really like Deep-Silver's input on my whole T_CASE error Parse error situation :).

 

Thank you all.

 

Arkady

Edited by Voland

People dont change, people realize.

Share this post


Link to post
Share on other sites

I am looking to implement this in my store. Which package should I download?

 

Thanks.


Nancy

Share this post


Link to post
Share on other sites

Hey All,

 

Is there any word on when the "referral" thing will be implemented? i.e - type in names and emails ... if one of them sign's up the referrer gets a set amount of points if they make a purchase.

 

Something around them lines.

 

:)

 

Peace !!

Share this post


Link to post
Share on other sites
Hi...I've got few questions here.

 

I'm using MVS (Multi Vendor Shipping) for my store as well.From my observation,the Points/Rewards script is calculate points from shipping cost too i mean TOTAL ORDER,eventhough i've already disable it from calculating the shipping cost from admin (configuration).

 

Can anyone solve my problem?Should i edit something?

 

BUMP >_< :(

Share this post


Link to post
Share on other sites

One more question:

 

The auto installer will only effect my sql? I have a modified cart and don't want to disrupt the rest of the files.

 

Thanks.


Nancy

Share this post


Link to post
Share on other sites
Yes i did answer all those post in regard to "Call to undefined function"

in your case the missing function cuse due to you using ms1 while this module is bild for ms2 ONLY. the function tep_count_customer_orders(); is taken from general.php and not this mod the fuction is a commen function for ms2 and found in catalog/account_history.php.

You can try to download ms2 ,open catalog/includes/functions/general.php and look for tep_count_customer_orders and copy the hole function to your catalog/includes/functions/general.php .

maybe it will work for you but i can't promiss you as i have no way to confirm it.

Good luck

 

I am having this problem too. I then added:

function tep_count_customer_orders($id = '', $check_session = true) {

global $customer_id;

 

if (is_numeric($id) == false) {

if (tep_session_is_registered('customer_id')) {

$id = $customer_id;

} else {

return 0;

}

}

 

 

and now get this error:

Parse error: parse error, unexpected $ in /usr/home/tfs/public_html/catalog/includes/functions/general.php on line 1259

 

 

Help would be greatly appreciated!


Nancy

Share this post


Link to post
Share on other sites
I am having this problem too. I then added:

function tep_count_customer_orders($id = '', $check_session = true) {

global $customer_id;

 

if (is_numeric($id) == false) {

if (tep_session_is_registered('customer_id')) {

$id = $customer_id;

} else {

return 0;

}

}

and now get this error:

Parse error: parse error, unexpected $ in /usr/home/tfs/public_html/catalog/includes/functions/general.php on line 1259

Help would be greatly appreciated!

 

The whole function in general.php should look like this:

(this is MS2 function with small changes for use in MS1)

 

function tep_count_customer_orders($id = '', $check_session = true) {
global $customer_id;

if (is_numeric($id) == false) {
  if (tep_session_is_registered('customer_id')) {
	$id = $customer_id;
  } else {
	return 0;
  }
}

if ($check_session == true) {
  if ( (tep_session_is_registered('customer_id') == false) || ($id != $customer_id) ) {
	return 0;
  }
}

$orders_check_query = tep_db_query("select count(*) as total from " . TABLE_ORDERS . " where customers_id = '" . (int)$id . "'");
$orders_check = tep_db_fetch_array($orders_check_query);

return $orders_check['total'];
 }

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×