Jump to content
deep-silver

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

Recommended Posts

Hi,

Firstly, Love the module!

 

Secondly, I have noticed some behaviour which I do not quite understand. This happens on both my test shop and the demo site. I have a lot of other contribs on my shop, so I made sure to test the demo shop before posting.

 

Lets say a customer has a balance of 200 points.

 

1. The customer places an order, and selects to use some points. (eg. 50 points).

The 50 points are deducted, and marked as "Redeemed" in the my_points.php page. The customer now has 150 points.

 

2. The admin logs in and views "pending points". They see that there is a pending points item in the table. This Item shows the points the customer wil RECEIVE for this transaction (makes no mention of a points deduction at this stage).

 

3. The admin clicks "Confirm Points", and selects "Queue in database" (whether you select queue or not does not seem to change the outcome of this example).

 

The 50 points are deducted *again*, meaning the customer has had 100 points total taken from their balance, for one transaction. The example customer now has 100 points left.

 

Is this right?

Does this happen to anyone else?

Should it happen?

Am I missing something?

 

Cheers,

James Wyld

resolvIT Pty Ltd

Share this post


Link to post
Share on other sites
Hi,

Firstly, Love the module!

 

Secondly, I have noticed some behaviour which I do not quite understand.  This happens on both my test shop and the demo site.  I have a lot of other contribs on my shop, so I made sure to test the demo shop before posting.

 

Lets say a customer has a balance of 200 points.

 

1. The customer places an order, and selects to use some points. (eg. 50 points).

The 50 points are deducted, and marked as "Redeemed" in the my_points.php page.  The customer now has 150 points.

 

2. The admin logs in and views "pending points".  They see that there is a pending points item in the table.  This Item shows the points the customer wil RECEIVE for this transaction (makes no mention of a points deduction at this stage).

 

3. The admin clicks "Confirm Points", and selects "Queue in database" (whether you select queue or not does not seem to change the outcome of this example).

 

The 50 points are deducted *again*, meaning the customer has had 100 points total taken from their balance, for one transaction.  The example customer now has 100 points left.

 

Is this right?

Does this happen to anyone else?

Should it happen?

Am I missing something?

 

Cheers,

James Wyld

resolvIT Pty Ltd

 

 

From what you are saying:

 

Customer has 150 points already. We'll say 1 point equals 1 dollar.

 

They buy something for $200 dollars. when they check out, they deduct 50 points which is 50 dollars.

 

So their balance is $150.00 they must pay.

 

So they are earning points again for the $150 they are about to spend.

 

That sounds right.

 

I wish I could get my redemp back up and running. see posts above.:(


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
Is this right?

Does this happen to anyone else?

Should it happen?

Am I missing something?

 

Cheers,

James Wyld

resolvIT Pty Ltd

No.

It should not be this way I will fix it today.

Thank you.


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

Share this post


Link to post
Share on other sites
Is this right?

Does this happen to anyone else?

Should it happen?

Am I missing something?

 

Cheers,

James Wyld

resolvIT Pty Ltd

O.k

Sorry for keeping you waiting.

Here is the fix for the bug.

 

open.....

admin/includes/languages/english/customers_points_pending.php

 

find this...(start at line no.25)

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

 $customer_query = tep_db_query('select customer_id, date_added, points_pending from '. TABLE_CUSTOMERS_POINTS_PENDING .' where orders_id = '. $oID);
 $customer_points = tep_db_fetch_array($customer_query);
         
	 tep_db_query('update '. TABLE_CUSTOMERS . ' set customers_shopping_points = customers_shopping_points + '. $customer_points['points_pending'] . 'where customers_id = '. $customer_points['customer_id']); 

         $customer_notified = '0';
         $customer_query = tep_db_query("select customers_lastname, customers_firstname, customers_gender, customers_email_address, customers_shopping_points from " . TABLE_CUSTOMERS . " where customers_id = '" . $customer_points['customer_id'] . "'");
         $customer = tep_db_fetch_array($customer_query);
         $balance = $customer['customers_shopping_points'];
         $gender = $customer['customers_gender'];
         $first_name = $customer['customers_firstname'];
         $last_name = $customer['customers_lastname'];
         $name = $first_name . ' ' . $last_name;
         
         if (isset($HTTP_POST_VARS['notify']) && ($HTTP_POST_VARS['notify'] == 'on')) {
           $notify_comment = '';
           if (isset($HTTP_POST_VARS['comment']) && tep_not_null($comment)) {
             $notify_comment = sprintf(EMAIL_TEXT_COMMENT . ' ' . $comment) . "\n";
           }

           if (ACCOUNT_GENDER == 'true') {
               if ($gender == 'm') {
               $greet = sprintf(EMAIL_GREET_MR, $last_name);
           } else {
               $greet = sprintf(EMAIL_GREET_MS, $last_name);
             }
           } else {
               $greet = sprintf(EMAIL_GREET_NONE, $first_name);
           }
           $email_text = $greet  . "\n" . EMAIL_TEXT . "\n" . EMAIL_TEXT_BALANCE_CONFIRMED . "\n" . EMAIL_TEXT_ORDER_NUMBER . ' ' . $oID . "\n" . EMAIL_TEXT_DATE_ORDERED . ' ' . tep_date_long($customer_points['date_added']) . "\n" . TABLE_HEADING_POINTS . ' = ' . $customer_points['points_pending'] . "\n" . $notify_comment . TABLE_HEADING_POINTS_VALUE . ' ' . $currencies->format($customer_points['points_pending'] * REDEEM_POINT_VALUE) . "\n" . EMAIL_TEXT_BALANCE . ' ' . $balance . ' ' . TABLE_HEADING_POINTS_VALUE . ' = ' . $currencies->format($balance * REDEEM_POINT_VALUE) . "\n" . EMAIL_TEXT_POINTS_URL . "\n" . tep_catalog_href_link(FILENAME_CATALOG_MY_POINTS) . "\n" . EMAIL_TEXT_SUCCESS_POINTS . "\n" . EMAIL_CONTACT . "\n\n" . EMAIL_SEPARATOR . "\n" . '<b>' . STORE_NAME . '</b>.' . "\n\n";

           tep_mail($name, $customer['customers_email_address'], EMAIL_TEXT_SUBJECT, $email_text, STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS);

           $customer_notified = '1';
           $messageStack->add_session(sprintf(NOTICE_EMAIL_SENT_TO, $name . '( ' . $customer['customers_email_address']. ').'), 'success');
         }
      
       if (isset($HTTP_POST_VARS['queue_confirm'])) {
        tep_db_query('update '. TABLE_CUSTOMERS_POINTS_PENDING . ' set status  = 2 where orders_id = '. $oID);          
     } else {
           $messageStack->add_session(NOTICE_RECORED_REMOVED, 'warning');
           tep_db_query("delete from " . TABLE_CUSTOMERS_POINTS_PENDING . " where orders_id = '" . $oID . "'");
     }          
           $messageStack->add_session(SUCCESS_POINTS_UPDATED, 'success');
           tep_redirect(tep_href_link(FILENAME_CUSTOMERS_POINTS_PENDING, tep_get_all_get_params(array('oID', 'action'))));
       break;

 

with this.....

 

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

 $customer_query = tep_db_query('select customer_id, date_added, points_pending, status from '. TABLE_CUSTOMERS_POINTS_PENDING .' where status  = 1 and orders_id = '. $oID);
 $customer_points = tep_db_fetch_array($customer_query);
         
           if ($customer_points['status'] == 1) {
    tep_db_query('update '. TABLE_CUSTOMERS . ' set customers_shopping_points = customers_shopping_points + '. $customer_points['points_pending'] . 'where customers_id = '. $customer_points['customer_id']); 
     }

         $customer_notified = '0';
         $customer_query = tep_db_query("select customers_lastname, customers_firstname, customers_gender, customers_email_address, customers_shopping_points from " . TABLE_CUSTOMERS . " where customers_id = '" . $customer_points['customer_id'] . "'");
         $customer = tep_db_fetch_array($customer_query);
         $balance = $customer['customers_shopping_points'];
         $gender = $customer['customers_gender'];
         $first_name = $customer['customers_firstname'];
         $last_name = $customer['customers_lastname'];
         $name = $first_name . ' ' . $last_name;
         
         if (isset($HTTP_POST_VARS['notify']) && ($HTTP_POST_VARS['notify'] == 'on')) {
           $notify_comment = '';
           if (isset($HTTP_POST_VARS['comment']) && tep_not_null($comment)) {
             $notify_comment = sprintf(EMAIL_TEXT_COMMENT . ' ' . $comment) . "\n";
           }

           if (ACCOUNT_GENDER == 'true') {
               if ($gender == 'm') {
               $greet = sprintf(EMAIL_GREET_MR, $last_name);
           } else {
               $greet = sprintf(EMAIL_GREET_MS, $last_name);
             }
           } else {
               $greet = sprintf(EMAIL_GREET_NONE, $first_name);
           }
           $email_text = $greet  . "\n" . EMAIL_TEXT . "\n" . EMAIL_TEXT_BALANCE_CONFIRMED . "\n" . EMAIL_TEXT_ORDER_NUMBER . ' ' . $oID . "\n" . EMAIL_TEXT_DATE_ORDERED . ' ' . tep_date_long($customer_points['date_added']) . "\n" . TABLE_HEADING_POINTS . ' = ' . $customer_points['points_pending'] . "\n" . $notify_comment . TABLE_HEADING_POINTS_VALUE . ' ' . $currencies->format($customer_points['points_pending'] * REDEEM_POINT_VALUE) . "\n" . EMAIL_TEXT_BALANCE . ' ' . $balance . ' ' . TABLE_HEADING_POINTS_VALUE . ' = ' . $currencies->format($balance * REDEEM_POINT_VALUE) . "\n" . EMAIL_TEXT_POINTS_URL . "\n" . tep_catalog_href_link(FILENAME_CATALOG_MY_POINTS) . "\n" . EMAIL_TEXT_SUCCESS_POINTS . "\n" . EMAIL_CONTACT . "\n\n" . EMAIL_SEPARATOR . "\n" . '<b>' . STORE_NAME . '</b>.' . "\n\n";

           tep_mail($name, $customer['customers_email_address'], EMAIL_TEXT_SUBJECT, $email_text, STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS);

           $customer_notified = '1';
           $messageStack->add_session(sprintf(NOTICE_EMAIL_SENT_TO, $name . '( ' . $customer['customers_email_address']. ').'), 'success');
         }
      
       if (isset($HTTP_POST_VARS['queue_confirm'])) {
        tep_db_query('update '. TABLE_CUSTOMERS_POINTS_PENDING . ' set status  = 2 where status  = 1 and orders_id = '. $oID);          
     } else {
           $messageStack->add_session(NOTICE_RECORED_REMOVED, 'warning');
           tep_db_query("delete from " . TABLE_CUSTOMERS_POINTS_PENDING . " where orders_id = '" . $oID . "'");
     }          
           $messageStack->add_session(SUCCESS_POINTS_UPDATED, 'success');
           tep_redirect(tep_href_link(FILENAME_CUSTOMERS_POINTS_PENDING, tep_get_all_get_params(array('oID', 'action'))));
       break;

 

Thats it.

and thanks again for this bug report.


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

Share this post


Link to post
Share on other sites
open.....

    admin/includes/languages/english/customers_points_pending.php

I take it you mean: admin/customers_points_pending.php

That is where I found the necessary code to change in my install ;)

 

Thats it.

and thanks again for this bug report.

 

Thanks for the time and effort you must have put in to making this module. Without a decent module to start with, there would be no bug to report :thumbsup: :D

Share this post


Link to post
Share on other sites

####### POINTS AND REWARDS MODULE V1.30 #########

 

Dated: July.23.2005 V1.30

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

1.Tewaked the code for a faser load of *.PHP

The same idea with much shorter code.

2.Fixed bug in admin/customers_points_pending.php

where confirming points for order with redeemed points return wrong result.(thanks to James Wyld,resolvIT Pty Ltd.).

3.Added Admin features. admin can now Set the Products Id allowed When

Products Restriction enabled.(unlimited products).

or Set the Categories ID allowed When Products Restriction enabled.(unlimited categories path).

4.Updated..

catalog/includes/languages/english/my_points_help.php

to refalx the above changes.

5.Made redemptions box compatible with select payment method alart so disabling the java script is no longer neccessry.

6.Added java script to check for invalid charecters entered to redemptions box .

When a customers enter invalid charecter(any charecters other then numbers).This is to avoid errors reading

points value when using languages convert keborards like Japanese or Chinese to input digit. This javescript

make sure that only numbers entered.

7.Changed html layout for redemptions box to match payment layout and center shop contribution.

8.Added an extra error to inform customer using small amount of points that the points value is not enough

to cover the cost and ask to select another payment method.

9.improved security by minimazing seassons to use by this module.

10.some other small changes that even i can't remember...

The demo site is still online so testing is available.

 

DEEP-SILVER


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

Share this post


Link to post
Share on other sites

Version 1.30 has one error:

 

In english.php

 

This is the correct code:

 

// Points/Rewards Module V1.30 BOF

define('REDEEM_SYSTEM_ERROR_POINTS', 'REDEEM POINTS ERROR ! You do not have that many Shopping points to spend.');

define('REDEEM_SYSTEM_ERROR_POINTS_EMPTY', 'REDEEM POINTS ERROR ! You did not enter points to spend.');

define('REDEEM_SYSTEM_ERROR_POINTS_MAX', 'REDEEM POINTS ERROR ! We are sorry but you Cannot spend more then ' . number_format(POINTS_MAX_VALUE,2) . ' points per order.');

define('REDEEM_SYSTEM_ERROR_POINTS_NOT', 'Points value are not enough to cover the cost of your purchase. Please select another payment method');

define('REDEEM_SYSTEM_ERROR_POINTS_OVER', 'REDEEM POINTS ERROR ! Points value can not be over the total value. Please enter points');

// Points/Rewards Module V1.30 EOF

 

There is an extra ")" that is not supposed to be there.


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
Version 1.30 has one error:

 

In english.php

 

There is an extra ")" that is not supposed to be there.

yes i know and thank you i already fixed that.

In the new version i added the number_format to the points display so it will be easy to get rid of the 2 decimal for users that don't use the 0.5 points.

and an extra ) sliped in .sorry and thanks again,


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

Share this post


Link to post
Share on other sites

Missed one step for update users.

 

open catalog/checkout_payment.php

find this.... (aprox. line no.120)

 

<?php //echo $payment_modules->javascript_validation(); disabled for Points/Rewards Module v1.20 */

 

..and replace it with this.......

 

<?php echo $payment_modules->javascript_validation(); ?>

(just enable the javascript)


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

Share this post


Link to post
Share on other sites

Thanks. Version 1.20 stopped working for some reason after our host upgraded "something". I was quite disappointed not at the contribution but at the host themselves.

After upgrading to 1.30, the contribution started to work again.

 

Kudos man, this should be the contribution of the year. Easy contribution to install, something that every store can use since it is not specific for just one niche, author is constantly improving it and quick to reponse on help.

 

Remember guys, he is doing this for free and it is much appreciated.

 

Again, thanks deep-silver.

Edited by Young Tae Byun

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
Thanks.  Version 1.20 stopped working for some reason after our host upgraded "something".  I was quite disappointed not at the contribution but at the host themselves.

After upgrading to 1.30, the contribution started to work again.

 

Kudos man, this should be the contribution of the year.  Easy contribution to install, something that every store can use since it is not specific for just one niche, author is constantly improving it and quick to reponse on help.

 

Remember guys, he is doing this for free and it is much appreciated.

 

Again, thanks deep-silver.

Thank you. :D

After reading your post from last week. and the replay you got for it. i then checked the bug report in regard to sql sever version.

The result are in the checkout_payment.php the code bild in another way from the code before.

Anyway good to know that you got it to work again.


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

Share this post


Link to post
Share on other sites

How to remove unwanted decimal.

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

 

** If you don't use half points and wish to get rid of the 2 decimal showing on points (i.e change from 1,000.00 points to 1,000 points).

open all files that show points and look for the code that start with this ...

 

number_format(

 

and remove the ,2 between "number_format(" and ")" .

 

for example:

   open catalog/my_points.php
  
...find this (line no.168)
  
number_format($points['points_pending'],2)

....and replace it with this...

number_format($points['points_pending'])

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

THAT'S IT.

Enjoy.


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

Share this post


Link to post
Share on other sites

Thank you, i just installed the module and it works like a charm, there was one bug in the english.php file where there was and extra ')' but quick fix and it works fine.

 

thank you very much for doing this. it is what i have been wanting to do for a long time!

 

THIS SHOULD BE THE CONTRIBUTION OF THE YEAR!

Edited by Altbier

Share this post


Link to post
Share on other sites

Arrrgh, everything works except for when the customer at checkout, there is no place for them to redeem points.

 

I gave myself 1001 points and there is no place at checkout to redeem them.

 

where did I go wrong?

 

www.mrbundles.com

Edited by Altbier

Share this post


Link to post
Share on other sites

OK, I have triple checked my code, the settings and made sure I had enough points to redeem.

 

I have added a module to add electronic check and I am wondering if that has overridden points system even though the code is there.

 

any thoughts?

 

www.mrbundles.com

Edited by Altbier

Share this post


Link to post
Share on other sites
Arrrgh, everything works except for when the customer at checkout, there is no place for them to redeem points.

 

I gave myself 1001 points and there is no place at checkout to redeem them.

 

where did I go wrong?

 

www.mrbundles.com

Go to your module setting and make sure no ristraction apply.

1.Enable Points system must be set to "true".

2.Enable Redemptions system must be set to "true".

3.make sure that the folowing fuctions set to "false"

a.Enable Products Restriction.

b.Enable Products Price Restriction.

c.Limit Points Redemptions to exact amount.

4.If you wish to limit points before Redemptions, set points limit to.

make sure that its set to 0.

5.If you wish to limit points to be use per order, set points Max to.

make sure the the max points limit is much higher then the points use.


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

Share this post


Link to post
Share on other sites
Go to your module setting and make sure no ristraction apply.

1.Enable Points system must be set to "true".

2.Enable Redemptions system must be set to "true".

3.make sure that the folowing fuctions set to "false"

a.Enable Products Restriction.

b.Enable Products Price Restriction.

c.Limit Points Redemptions to exact amount.

4.If you wish to limit points before Redemptions, set points limit to.

make sure that its set to 0.

5.If you wish to limit points to be use per order, set points Max to.

make sure the the max points limit is much higher then the points use.

All of that was correct, the only thing i had set that i changed today was:

limit points before redemptions = 500

max points per order 500

 

i changed those to 700 and 500 but still it does not show up at check out.

Share this post


Link to post
Share on other sites
All of that was correct, the only thing i had set that i changed today was:

limit points before redemptions = 500

max points per order 500

 

i changed those to 700 and 500 but still it does not show up at check out.

mrbcc.JPG

are these set correctly?

Share this post


Link to post
Share on other sites

One option that you may want to add on the admin side is that ... when a customer decides to redeem points during checkout, they should not earn points on that purchase.

 

I mean, you could make that an option for the admin to turn that on or off because if you think about it, we'll lose more of our profit.


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
One option that you may want to add on the admin side is that ... when a customer decides to redeem points during checkout, they should not earn points on that purchase.

 

I mean, you could make that an option for the admin to turn that on or off because if you think about it, we'll lose more of our profit.

 

I don't think that is true ?! They only earn points for the part of the purchase which is paid without redeemed points so you don't loose profit on such purchase as I see it.

Share this post


Link to post
Share on other sites
One option that you may want to add on the admin side is that ... when a customer decides to redeem points during checkout, they should not earn points on that purchase.

 

I mean, you could make that an option for the admin to turn that on or off because if you think about it, we'll lose more of our profit.

I'm so sorry but this option is not an issue as customers deserve points for cash

spend at our online shop. so even if the order is paid half with points and half with cash they still deserve the points for the other half.


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

Share this post


Link to post
Share on other sites
I'm so  sorry but this option is not an issue as customers deserve points for cash

spend at our online shop. so even if the order is paid half with points and half with cash they still deserve the points for the other half.

 

That may be the case for your shop but not for mine ... which is why I am suggesting that option. This contribution is being used for different shops for different purposes NOT just for one style shop.


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
Arrrgh, everything works except for when the customer at checkout, there is no place for them to redeem points.

 

I gave myself 1001 points and there is no place at checkout to redeem them.

 

where did I go wrong?

 

www.mrbundles.com

Thanks for taking the time to do this, I'll make it worth your time.

modules we have added are as follows:  easy populate, electronic check(which may be causing the problem at check out), wish list, large image processor.

Let me know what type of cigars you like, and also what type beer you like.  I am a brewer.

 

Plus, send me your address and I'll get a package out tomorrow.

 

cheers!

DONE!

1.

You missed the step in refer to checkout_payment.php.

I added this part and did not tuch any thing alse.

please make sure to change admin ,ftp,databse passwords and user name as this forum is not secure.

2.

When you set the minimum points before redemptions to any amount that higher then the maximum points allowed, then the redemptions box will not show up.

3.

Please go over the install.txt in found in the package you downloaded.

just do a quick check to make sure you did not missed any step.

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

That's it enjoy.

and don't worry as i don't smoke and i have lots of drink as i own a bar.

 

God bless all.

Good luck with your busineses. :thumbsup: :thumbsup:

P.S when time permit you should clean up your site. as the front page contain a funny ////// at the buttom.


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

Share this post


Link to post
Share on other sites

I'll definitely take those free cigars!


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

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

×