Jump to content
deep-silver

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

Recommended Posts

i'm far from a php guru so i'm scared to experiment unless somebody else has taken the plunge before me... :) but thank you for the suggestion

are you using the auto confirm points?

alse when confirming pending points you have an option to delete this row one confirmed.

as i worte in README.txt

What this module does not do ?

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

1.The system designed for a small to medium shops.

Since shopping points cosider as money when redeemed. awarded points default status is pending.

Customers shopping points account will never be auto-credited(except points for new signup if enabled).

if you own a large shop with lots of orders daily, it could be hard to keep track of points

then this system is NOT for you.

2.When admin delete order while points status for that order is still pending. those points will also be

deleted, however if admin already approved those points, admin must delete them manually(via admin panel).

i was worried that one day it will happen. in previuse version pending points row used to auto delered once cconfirmed untill someone post a request to have an option to keep the rows for the record.

Do you think that we should have an option to remove pending points rows upon confirm?

or just to have an option in admin/customers_points_pending that will delete points rows that thier status is confirmed by dates?

or on admin order page where the option to confirm the point will delete the row as wel?


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

Share this post


Link to post
Share on other sites
What exactly occurs that causes you to lose money with each order?

 

The money never ends up in my account. I installed the oscommerce PayPal+IPN, the latest version supplied by the dev team in order to make the Point Rewards work with PayPal, since the Points Rewards states to make changes in the PayPayl_IPN, which I didn't have.

 

At this point I am going to need to choose... which seems like I'll need to ditch Points Rewards 1.60.

 

Maybe an odler version will work better, but oh my.. what work it will be to unistall and reinstall


My Contributions

 

Henry Smith

Share this post


Link to post
Share on other sites
are you using the auto confirm points?

not sure? but i approve my points via orders.php in admin once i have dispatched the customer's order.

 

 

alse when confirming pending points you have an option to delete this row one confirmed.

as i worte in README.txt

if i confirm points via customers_points.php it works perfectly that way

 

in previuse version pending points row used to auto delered once cconfirmed untill someone post a request to have an option to keep the rows for the record.

oh i did not know that. which release was it in? would i be able to get it to work with the orders.php admin points confirm?

 

Do you think that we should have an option to remove pending points rows upon confirm?

or just to have an option in admin/customers_points_pending that will delete points rows that thier status is confirmed by dates?

or on admin order page where the option to confirm the point will delete the row as wel?

since you say some people want to keep the rows even after confirmation, it would probably be easiest for everybody if there was a tick box on orders.php that allowed deletion after confirmation? (similar to how you recently added the ability to approve points via orders.php) that way there's an solution to please both the people that want to keep rows and those that want to delete them :)

 

ps. i know there were many of us looking for a % discount contribution (like ccgv) to work hand in hand with points & rewards. tonight i was able to EASILY install boxtel's easy discount contribution and it works perfectly together with points & rewards: http://forums.oscommerce.com/index.php?showtopic=190156

Edited by eww

Share this post


Link to post
Share on other sites
not sure? but i approve my points via orders.php in admin once i have dispatched the customer's order.

if i confirm points via customers_points.php it works perfectly that way

oh i did not know that. which release was it in? would i be able to get it to work with the orders.php admin points confirm?

since you say some people want to keep the rows even after confirmation, it would probably be easiest for everybody if there was a tick box on orders.php that allowed deletion after confirmation? (similar to how you recently added the ability to approve points via orders.php) that way there's an solution to please both the people that want to keep rows and those that want to delete them :)

 

ps. i know there were many of us looking for a % discount contribution (like ccgv) to work hand in hand with points & rewards. tonight i was able to EASILY install boxtel's easy discount contribution and it works perfectly together with points & rewards: http://forums.oscommerce.com/index.php?showtopic=190156

you will have it on next version (comming soon)


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

Share this post


Link to post
Share on other sites

did someone say new version? :D


Remember what the Bible says: He who is without sin, cast the first rock. And I shall smoketh it.

Share this post


Link to post
Share on other sites
custodian:

 

That is the same thing that happens to me.

Try the PayPal IPN version by DevOsc (Gregory Babool). It works with CCGV, so should work with this.


The Coopco Underwear Shop

 

If you live to be 100 years of age, that means you have lived for 36,525 days. Don't waste another, there aren't many left.

Share this post


Link to post
Share on other sites
Try the PayPal IPN version by DevOsc (Gregory Babool). It works with CCGV, so should work with this.

 

 

That's the one I'm using that I can't get to work. I got that one becuase I assumed that since it was from the Dev Team that... oh well... I'm just going to drop it. I've been up all night setting up SSL, Merchant accounts, assigning new IP's to the system. The horse is already dead, and I'm tired of continually beating it. It's not worth my time.


My Contributions

 

Henry Smith

Share this post


Link to post
Share on other sites
Try the PayPal IPN version by DevOsc (Gregory Babool). It works with CCGV, so should work with this.

GUYS Please!!! HOw do you aspact to get support if you dont supply enough info !!!!!!!!!!

when i do search in contribution page for PayPal IPN , i get atleast 12 result.(non of them part of osCommerce m2.2

SO PLEASE what PayPal IPN type you talking about and WHAT version.

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

Changes to the PayPal IPN file:

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

Dated: NOV.02.2005

Modified by Deep Silver

www.deep-silver.com

To be used with Points/Rewards Module V1.60.

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

 

In short the paypal_ipn.php file integrates some of the code that would otherwise be found in other files e.g. checkout_process.php. In this case the code that can be found in checkout_process is replicated in the paypal_ipn file under the function: before_process()

 

So in order to maintain compatibility with the Points/Rewards Module V1.60 contribution you will need to remake those changes here.

*** Ensure that you have already installed the PayPal IPN module: osCommerce PayPal IPN Module v1.1 For 2.2MS2,

http://www.oscommerce.com/community/contri...arch,PayPal+IPN

*** Ensure that you set the options in this module under... "Transaction Type" you MUST select Aggregate alse

will not show the correct total at paypal,

 Open: catalog/includes/modules/payment/paypal_ipn.php

Find this.... (start at aprox. line no.77)

  global $cartID, $cart_PayPal_IPN_ID, $customer_id, $languages_id, $order, $order_total_modules;

.. and REPLACE it with this...(we just add this 2 elements to the line $customer_shopping_points, $customer_shopping_points_spending)

#### Points/Rewards Module V1.60 balance customer points BOF ####
//	global $cartID, $cart_PayPal_IPN_ID, $customer_id, $languages_id, $order, $order_total_modules;
  global $cartID, $cart_PayPal_IPN_ID, $customer_id, $languages_id, $order, $customer_shopping_points, $customer_shopping_points_spending, $order_total_modules;
#### Points/Rewards Module V1.60 balance customer points EOF ####*/

Find this.... (start at aprox. line no.178)

		tep_db_perform(TABLE_ORDERS_TOTAL, $sql_data_array);
	  }

.. and add this after...

#### Points/Rewards Module V1.60 balance customer points BOF ####
// customer shoppping points account balanced 
 if (USE_REDEEM_SYSTEM == 'true' && $customer_shopping_points_spending) {
$customer_shopping_points = tep_get_shopping_points();
  tep_set_shopping_points(($customer_shopping_points - $customer_shopping_points_spending), $customer_id);
if ($customer_shopping_points_spending && DISPLAY_POINTS_REDEEMED == 'true') {
  tep_add_redeemed_points($customer_id, $insert_id, $customer_shopping_points_spending);
} 
 } 
// customer pending points added 
 if ((USE_POINTS_SYSTEM == 'true') && ($order->info['total'] > 0) && (get_award_discounted($order) == true)) {
$redemption_awards = get_redemption_awards($customer_shopping_points_spending);
$points_toadd = get_points_toadd($order);
if ((get_redemption_awards($customer_shopping_points_spending) == true) && ($points_toadd >0))
  tep_add_pending_points($customer_id, $insert_id, $points_toadd);
 }
#### Points/Rewards Module V1.60 balance customer points EOF ####*/

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

2.   Find this.... (start at aprox. line no.557)

// unregister session variables used during checkout
  tep_session_unregister('sendto');
  tep_session_unregister('billto');
  tep_session_unregister('shipping');
  tep_session_unregister('payment');
  tep_session_unregister('comments');

... and add after.....

  tep_session_unregister('customer_shopping_points');// Points/Rewards Module V1.60
  tep_session_unregister('customer_shopping_points_spending');// Points/Rewards Module V1.60

The above changes should be applied to any external payment module( like PayPal IPN)

The above changes are to give you an idea on how to modified any external payment module( like PayPal IPN)

I have no way to test it but sould work

USE IT AT YOUR OWN RISK

 

Deep Silver

P.S in this topic a few pages back you will find out that i did went out of my way and gave support for paypal INP and did not get any result answer asuming the problem solved.


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

Share this post


Link to post
Share on other sites
super, i can't wait!!! :)

thats is what i worried about and because you been nice (so far :P )

below is a link to a modifed admin/orders.php

this is part of the next version.

giving you that under one ondition. YOU MUST run test and report here results good or bad

any bugs or a better idea.

so by downloading this you aggree to the above ondition

Download the modified admin/orders.php


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

Share this post


Link to post
Share on other sites

absolutely! :D

i have edited my orders.php lang file, however my admin/orders.php is HEAVILY modified with other contributions; is it possible for you to tell me which part of the orders.php is new (since your last release)?

 

i'm trying to compare right now, but i just want to make sure i don't miss anything and end up telling you something's wrong if there really isn't anything wrong except for me missing a line :)

Share this post


Link to post
Share on other sites
absolutely! :D

i have edited my orders.php lang file, however my admin/orders.php is HEAVILY modified with other contributions; is it possible for you to tell me which part of the orders.php is new (since your last release)?

 

i'm trying to compare right now, but i just want to make sure i don't miss anything and end up telling you something's wrong if there really isn't anything wrong except for me missing a line :)

just replace the modifed part of points reward v.160 with the v.200 marked at the downloaded files


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

Share this post


Link to post
Share on other sites

just tried to replace everything between the #### points bof and eof, nothin happened.

 

but when i loaded orders.php as a test file, it was a duplicate of points_pending.. did i mix something up?

Share this post


Link to post
Share on other sites
edit: deep-silver, i just loaded orders.php again (fresh download from your link) and it too was points_pending and i could not find a line with v.200

sorry the lines still marked as v1.60

 

just replace the addon for 1.60 you already have with the one in the zip.

the result should look like this...

points.gif

 

Got the idea?

if you want to confirm and delete just check the "and delete"

Edited by deep-silver

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

Share this post


Link to post
Share on other sites

oops, my apologies deep silver. i was only replacing the bof and eof lines. i completely forgot about this little edit:

<!-- // Points/Rewards Module V1.60 check_box_bof //-->

 

i did a test with a fresh order and it worked perfectly. thank you very much for this!!!! :thumbsup:

 

one more question: how can i get rid of the decimal from the "points approved" email?

 

mine looks like: ORDER NUMBER: 61664

Tuesday 07 March, 2006

POINTS = 45.95

worth $2.30

Your total Discount Points balance: 45.95 worth = $2.30

 

 

i just want it to say:

ORDER NUMBER: 61664 from Tuesday 07 March, 2006

 

You have been awarded a discount of $2.30 off your next purchase!

Edited by eww

Share this post


Link to post
Share on other sites

deep-silver, found a tiny bug in that edit you offered me in the zip file.

 

when i updated a status, approved & deleted points from pending (and notified customer), the status was sent to the database twice using two different orders_status_history_id's.

 

to prevent this, in admin/orders.php look for:

			if (isset($HTTP_POST_VARS['confirm_points']) && ($HTTP_POST_VARS['confirm_points'] == 'on')) {
		tep_db_query('update '. TABLE_CUSTOMERS_POINTS_PENDING . ' set status = 2 where status = 1 and orders_id = '. $oID);
		}

	   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($points_comments)  . "')");
	  }

 

change to:

if (isset($HTTP_POST_VARS['confirm_points']) && ($HTTP_POST_VARS['confirm_points'] == 'on')) {

tep_db_query('update '. TABLE_CUSTOMERS_POINTS_PENDING . ' set status = 2 where status = 1 and orders_id = '. $oID);

}

 

// 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($points_comments) . "')");

}

 

when i first had seen the duplicate comments, i thought i had hit the button twice until i processed several orders after and it kept occuring ;)

 

i just tested my fix and there was not a duplicate entry, but i did receive my "you got points" emails and the order status notification email :)

Share this post


Link to post
Share on other sites

I have installed this contribution and it all seems to work great but I am running into one problem.

 

When I update points through the admin section an email is sent to my customer telling them about the adjustment and to click the link to review their points. However there is no link it just says "catalog/my_points.php" Did I miss something when I did the install? I can't seem to figure out how to make it so the link works.

 

Any ideas?

 

Thanks,

Amanda

Share this post


Link to post
Share on other sites
deep-silver, found a tiny bug in that edit you offered me in the zip file.

 

when i updated a status, approved & deleted points from pending (and notified customer), the status was sent to the database twice using two different orders_status_history_id's.

 

to prevent this, in admin/orders.php look for:

			if (isset($HTTP_POST_VARS['confirm_points']) && ($HTTP_POST_VARS['confirm_points'] == 'on')) {
		tep_db_query('update '. TABLE_CUSTOMERS_POINTS_PENDING . ' set status = 2 where status = 1 and orders_id = '. $oID);
		}

	   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($points_comments)  . "')");
	  }

 

change to:

when i first had seen the duplicate comments, i thought i had hit the button twice until i processed several orders after and it kept occuring ;)

 

i just tested my fix and there was not a duplicate entry, but i did receive my "you got points" emails and the order status notification email :)

 

Just a suggestion, while the PHP gurus like you are at it. It'd also be nice to have a "mass" functionality in the next version

 

P.s. I couldn't get CCGV to work with Points (sigh!!) so I removed CCGV. If anyone has CCGV 5.16 and Points together successfully functioning, please let posts. Then I can retry to get these two great contributions in my site.

Share this post


Link to post
Share on other sites
Just a suggestion, while the PHP gurus like you are at it. It'd also be nice to have a "mass" functionality in the next version

:lol: far from that, i just trial & error until i get it right

 

deep-silver was having me test a functionality of this contribution that hadn't existed yet and considering i kept bugging for it, i got to be the lucky one to give it a test drive :)

 

i'm sure when he has time he will update the contribution as a whole. i'm not sure if there are any other features planned that we don't know about, so there's no sense in upgrading the edits that were offered me to test.

 

if you want functionality similar to ccgv WHILE using points & rewards, use easy discount instead: http://www.oscommerce.com/community/contri...h,easy+discount

 

works seamlessly with ponts & rewards and it only takes a minute or so for full installation :)

Share this post


Link to post
Share on other sites
I have installed this contribution and it all seems to work great but I am running into one problem.

 

When I update points through the admin section an email is sent to my customer telling them about the adjustment and to click the link to review their points. However there is no link it just says "catalog/my_points.php" Did I miss something when I did the install? I can't seem to figure out how to make it so the link works.

 

Any ideas?

 

Thanks,

Amanda

the admin is using a link to the account. if you sending out emails wothout the HTTP_SERVER that is maybe becuase your admin/includes/configure.php is missing something or set incorrectly.

you should do a test order and update the status via admin/order.php choose to notify customer, then make sure that the email that is sent out is not missing the same part of the link(as i have a stong feeling that you will have the same issue).

please post/report result here.


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

Share this post


Link to post
Share on other sites

Brilliant contribution.

 

Can already turn points system on and off.

 

Would like to see this feature also:

 

Allow only 'logged-in' users to see points on actual product info page.

 

If someone has a simple 'if statement' , I can incorporate this.

 

many thanks

Share this post


Link to post
Share on other sites
the admin is using a link to the account. if you sending out emails wothout the HTTP_SERVER that is maybe becuase your admin/includes/configure.php is missing something or set incorrectly.

you should do a test order and update the status via admin/order.php choose to notify customer, then make sure that the email that is sent out is not missing the same part of the link(as i have a stong feeling that you will have the same issue).

please post/report result here.

 

 

Ok. I did a test order and this is what I found.

 

The link in the original order to the customer to get a detailed invoice works perfect.

 

However when I update from pending to processing the link in the email to the customer for the detailed invoice just comes up like this: /catalog/account_history_info.php?order_id=12

 

This link does not work. Major difference between the two is that the first one shows the http://www.blahblahblah.com/catalog/accoun...php?order_id=12 and the second doesn't have www. anything.

 

This is how my points emails come up too. How can I fix this?

 

Thanks for the help,

Amanda

Share this post


Link to post
Share on other sites
Allow only 'logged-in' users to see points on actual product info page.

 

If someone has a simple 'if statement' , I can incorporate this.

 

many thanks

on product_info.php where i displays the points, surround it with something like

 

if (tep_session_is_registered('customer_id'))

//points code here

}

Share this post


Link to post
Share on other sites
on product_info.php where i displays the points, surround it with something like

 

if (tep_session_is_registered('customer_id'))

//points code here

}

 

Great it works.

 

Problem 2. I also want to hide the whole shopping points redemptions box which is near the bottom of the checkout_payment.php page. (plus other items on other pages which I can do later). I only want authorised customers to view this box. I added a new column 'hide_points' in customer tables - Value TRUE to hide points and FALSE to show points (added by me with new input boxes on customer account page via admin).

 

I want some registered users I have authorised via admin to see the 'shopping points redemptions box' and others not to.

 

Not too sure about the query to call the value TRUE or FALSE value from hide_points database.

 

And even more lost as to how to include the value TRUE or FALSE to show or hide the 'shopping points redemptions box' on checkout_payment.php page.

 

The following are my code changes to checkout_payment.php , but its not working.

 

<!-- BOF POINTS REWARDS Module V1.60 Redeemption box bof ADDITION-->
<?php
 //BOF ADDED THIS PART TO GET CUSTOMER HIDE POINTS STATUS
 $hidepoints_query = tep_db_query("select hide_points from " . TABLE_CUSTOMERS . " where customers_id = '" . (int)$customer_id . "' ");
  $hide_points = tep_db_fetch_array($hidepoints_query);
$hide_points['hide_points'] = 'hide_points';
//BOF ADDITION FOR STATUS  - HOWEVER ADDED  && ($hide_points = FALSE) in next line So that for all instances of FALSE, points can be seen, else hide
  if ((USE_REDEEM_SYSTEM == 'true') && ($hide_points = 'FALSE') && ($customer_shopping_points = tep_get_shopping_points()) && $customer_shopping_points > 0){
 if ((get_redemption_rules($order) == true) && (get_points_rules_discounted($order) == true)){
   if ($customer_shopping_points >= POINTS_LIMIT_VALUE){
	 if ((POINTS_MIN_AMOUNT == '') || ($cart->show_total() >= POINTS_MIN_AMOUNT) ){

?>
		<tr>
	  <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
	</tr>
	<tr>
	  <td><table border="0" width="100%" cellspacing="0" cellpadding="2">
		<tr>
		  <td class="main"><b><?php echo TABLE_HEADING_REDEEM_SYSTEM; ?></b></td>
	  </tr>
	</table></td>
  </tr>
  <tr>
	<td><table border="0" width="100%" cellspacing="1" cellpadding="2" class="infoBox">
	  <tr class="infoBoxContents">
		<td><table border="0" width="100%" cellspacing="0" cellpadding="2">
		  <tr>
			<td><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
		   <td class="main" width="100%" colspan="3"><?php echo TEXT_REDEEM_SYSTEM_START . number_format($customer_shopping_points) . TEXT_REDEEM_SYSTEM_MIDDLE . $currencies->format(tep_calc_shopping_pvalue($customer_shopping_points)) . '.'; ?></td>
		   <td><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
		 </tr>
		  <tr>
		   <td><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
<?php
$max_points = 0;
$max_points = ($order->info['total']/REDEEM_POINT_VALUE > POINTS_MAX_VALUE ? POINTS_MAX_VALUE : $order->info['total']/REDEEM_POINT_VALUE);
$max_points = ($customer_shopping_points > $max_points ? $max_points : $customer_shopping_points);
if (POINTS_LIMIT_EXACT == 'false'){
?>
		   <td class="main" width="100%" colspan="3"><?php printf(TEXT_REDEEM_SYSTEM_TOTAL, $currencies->format($order->info['total'])); ?></td>
		   <td><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
		 </tr>
<?php
  }
?>
<?php 
  if (POINTS_LIMIT_EXACT == 'true' && $customer_shopping_points >= POINTS_EXACT_VALUE){
if(tep_session_is_registered('customer_shopping_points_spending')) tep_session_unregister('customer_shopping_points_spending');
?>
		  <tr class="moduleRow" onMouseOver="rowOverEffect(this)" onMouseOut="rowOutEffect(this)" onClick="submitFunction()">
			<td><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
				<td class="main"><?php echo TEXT_REDEEM_SYSTEM_SPENDING_EXACT; ?></td>
				<td class="main" align="right"><?php echo tep_draw_checkbox_field('customer_shopping_points_spending', $customer_shopping_points_spending); ?></td>
				<td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
			  </tr>
<?php
 } else {
?>
		  <tr onClick="submitFunction()">
			<td><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
			<td><table border="0" width="100%" cellspacing="0" cellpadding="2">
				<td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
				<td class="main" ><?php echo TEXT_REDEEM_SYSTEM_SPENDING . '??' .tep_draw_input_field('customer_shopping_points_spending', $customer_shopping_points_spending , 'onBlur="validate(this)" onFocus="clearText(this)" maxlength="7" style="width:70px"'); ?><br><?php printf(TEXT_REDEEM_SYSTEM_SPENDING_ALL, number_format($max_points)); ?></td>
				<td class="main" align="right"><br><?php echo tep_draw_checkbox_field('customer_shopping_points_spending', $max_points); ?></td>
				<td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
			  </tr>
			</table></td>
		  </tr>
<?php 
 }
?>
		</table></td>
	  </tr>
	</table></td>
  </tr>
<?php 
   }
 }
  }
}

?>

If I can do this I will extend the show/hide feature to other parts later.

 

Any help would be appreciated.

 

Thanks

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

×