Jump to content
deep-silver

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

Recommended Posts

Hello,

 

Unfortunately, it still doesn't work properly with Paypal.

I tried the 3 following configurations in paypal_ipn.php :

1/ replaced :

  if (USE_REDEEM_SYSTEM == 'true' && $customer_shopping_points_spending) {
   tep_set_shopping_points(($customer_shopping_points - $customer_shopping_points_spending), $customer_id);
 }

 

with

 

  if(USE_REFERRAL_SYSTEM == 'true' && $customer_referral_points_spending) {
   tep_set_referral_points($customer_id,$i($customer_referral_points - $customer_referral_points_spending));
 }

 

2/ Then commented out :

tep_session_unregister('customer_shopping_points');// Points/Rewards Module v1.00

tep_session_unregister('customer_shopping_points_spending');// Points/Rewards Module v1.00

 

3/ With this 2 lines still commented out, reversed back to :

  if (USE_REDEEM_SYSTEM == 'true' && $customer_shopping_points_spending) {
   tep_set_shopping_points(($customer_shopping_points - $customer_shopping_points_spending), $customer_id);
 }

 

Regards,

Share this post


Link to post
Share on other sites

New Version with extra features as per request at the forum.

 

Added Admin features.

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

1.Enable/Disable points awarded for taxes.

2.Set the Maximum redeemptions points allowed per order.

3.Limit Points Redemptions to exact amount.

4.Enable/Disable Points credit information. shown in products info page.

 

Fixed grammar, spelling, layout in catalog/includes/languages/english/my_points_help.php

Thanks to James Stewart http://store.majiks.ca/

 

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

To test the customer side please use...

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

E-Mail Address: test@test.com

Password: users

to test the admin use this link

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


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

Share this post


Link to post
Share on other sites

What can i say. this contribution is fantastic. I thought i say congratulations to deep-silver for writing this fantastic contribution,and to my programmer who installed it for me.

 

Is it me or does everyone encounter slow loading in Customers pomts when they move from page to poge? Its really really slow for me.

 

Also

 

Im still tryng to figure out if we should que customers ponts in table or not. Can anyone help?

 

Thanks

Share this post


Link to post
Share on other sites

I wanted to stop and take the time to say THANK YOU!!! I have to also say that your install directions are the easiest I have seen to date! KUDOS! I had just instyalled it when I read y olu had updated it and the update went just as smooth as the install! You thought of everything!

 

Just to clarify if I want to restrict and item I have to put the manufacture model name in the appropriate box in admin?

 

I do not use manufacture feature and I was wondering if I have this disabled in admin but set the categories to a manufacturer redemptins will this still work? Not a biggy I can set it up this way if need be..

 

In testing phase now....

 

Maddie

Share this post


Link to post
Share on other sites

not sure if this is a problem or my lack of understanding... I set in admin

If you wish to limit points before Redemptions, set points limit to 20 and I placed an order and earned enough points but I never saw the tick box to redeem points.

 

When I set this limit to 0 I got the tick box.... Am I not understanding how this works?

 

Even when I chose to 'add points' it still did not give me the tick box on checkout_payment.php page

 

Thanks

Maddie

Edited by MzBeanz

Share this post


Link to post
Share on other sites
Im still tryng to figure out if we should que customers ponts in table or not. Can anyone help?

 

Thanks

 

I am testing and if you que each time then you ... have a better record of who you added/deleted points for and for pending a better record of who earned how many.... I prefer more detailed records. Without selecting que it merely deletes whatever functin you are doing.

 

Hope this helps sorry if you

Share this post


Link to post
Share on other sites

WOOHOO my points from paypal were deducted correctly!

But I have another questin. I placed a test order that totalled less then a dollar and no points are awarded.... and it showed up on my account page as follows:

 

06/15/2005 #72 Pending Shopping Points Pending 0

 

Is there a way to omit this is no points are earned?

 

Thanks

maddie

Share this post


Link to post
Share on other sites

is there a way for me to test paypal without having an account?

i've never used paypal so i really don't know how its work.

some other users PM that they use paypal with no problem,

maybe they using other paypal contributions or the one at oscommerce first install.

So like for the Credit Class & Gift Voucher contribution, changes must be re-applied in the paypal_ipn.php file.

For instance, with the Credit Class & Gift Voucher contribution, to have the Client's credit balance updated when using Paypal, the following line has to be added somewhere in paypal_ipn.php:

$order_total_modules->update_credit_account($i);

 

where update_credit_account is a function of the ot_gv.php file (order_total credit module).

However, here the customer shopping points balance is not a part of the ot_redemptions.php file but is a code directly inserted into the checkout_process.php file:

 

yes the line you refer too($order_total_modules->update_credit_account($i)

where update_credit_account is a function of the ot_gv.php file(order_total credit module). but its also in checkout_process.

The reason points & reward module is like that because i worked hard in order to avoid modifiying oscommerce files and when i say v i mean

replaceing original code. the less code to replace the better the chances are that it will work smoth with other conributions as well as other version of oscommerce.

Harald Ponce de Leon made oscommerce while putting is mind on the small detailes. if you look on other ot_modules in oscommerce non of them update database they are there to display, they are called from checkout_process as a sub and not the other way around.

so the main is checkout_process.php.

in order to install GV mod you had to modify(replace)oscommerce original code in more the 17 files and more then 42 code to replace and still there are lots of bugs.

when you see checkout_confirmation.php page that mean that you have passed all error checkers and the only things left to do is click on confirm order and you done. Now if you try to refresh the page while at checkout_confirmation.php page , your browser will return a java script alart saying "This page cannot refresh....bla bla bla..." but still give you the ability to reload it.

result= page forsed to re-display and to repeat all function in regard.

so if you have update_credit_account(); it will try to do that as well. so there is a risk that account will updated twice. now if you are using php 4.00 and higher the risk is less since as PHP4.3 take steps to try to avoid casess like that but the risk is still there and even if account dont upded twice other error might accur.

this is the main reason why other ot_modules don't have that kind of function and if they do then they call it from the /includes/functions.php

or any class.php

so this module bild on the same idea of oscommerce original files, it collect all variables nedded and do the fuction at /includes/functions/redeemptions.php.

 

Hope i got understood.

DEEP SILVER


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

Share this post


Link to post
Share on other sites
please try to use other words to make me understand what is your problem

 

 

Hey there! I will try

 

In the instructions it says you can limit the products they can use the points earned for.... it is set up to be able to restirct items by manufacturer. I do not have my products listed by manufacturer so I was wondering if there was another way I could do this. Perhaps by setting up a manufacture called REDEMPTION or something esle and then setting those products i do not want i ncluded to this manufacture... did I do better explaining?

 

Maddie

the restirct items is my MODEL name NOT manufacture. try to read instructions again?


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

Share this post


Link to post
Share on other sites

I understand it now! Only items which have the model [REDEMPTION] can be purchased using your points balance. But I need to have my model nam stay set the way I have it... can this be set to something else? like the manufacturer or other?

 

Thanks for your patience! This is truly amazing!

 

Maddie

Share this post


Link to post
Share on other sites

ATTENTION ALL...

Do not access points reward test shop untill i fix it.

Someone was smart enough to add a spam that pull out visitors to the test site

info and send email that look like from me

i have to clean few things give me time

DEEP :angry: :angry: :angry: :angry:


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

Share this post


Link to post
Share on other sites
I understand it now!  Only items which have the model [REDEMPTION] can be purchased using your points balance.  But I need to have my model nam stay set the way I have it... can this be set to something else? like the manufacturer or other?

 

Thanks for your patience!  This is truly amazing!

 

Maddie

NO.

please change [REDEMPTION] to what ever model name you have at your store

the [REDEMPTION] is just an example


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

Share this post


Link to post
Share on other sites
I wanted to stop and take the time to say THANK YOU!!! I have to also say that your install directions are the easiest I have seen to date! KUDOS!  I had just instyalled it when I read y olu had updated it and the update went just as smooth as the install! You thought of everything!

 

Just to clarify if I want to restrict and item I have to put the manufacture model name in the appropriate box in admin?

 

I do not use manufacture feature and I was wondering if I have this disabled in admin but set the categories to a manufacturer redemptins will this still work?  Not a biggy I can set it up this way if need be..

 

In testing phase now....

 

Maddie

points/rewards modules compatible with Cache and anycontribution that deal with

Cache . the test shop is slow,there are more then 4 or 5 users playing around

this some time result with slow server load and funny points result.

this is as far as my test shop slow reason. as for yours you should try again in some other time to see if its better and if its still slow then you are lucky as your site must be very popular :)

nobody else have this problem please check your server setting


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

Share this post


Link to post
Share on other sites

Great job, great contribution!!!! Thanks a lot!!! I have a store with more than 170 contributions installed now and it works fine.

 

I wanted to let you know that as I use CCGV I've made a mere modification in checkout_confirmation.php. Here's my piece of code :

 

///##### Points/Rewards  Module v1.00 check for errors BOF #######
//force customers to select other payment method if the points total not enough to cover the cost.
//ICW includes for CREDIT CLASS
//if ( ( is_array($payment_modules->modules) && (sizeof($payment_modules->modules) > 1) && !is_object($$payment) ) || (is_object($$payment) && ($$payment->enabled == false)) ) {
if ( (is_array($payment_modules->modules)) && (sizeof($payment_modules->modules) > 1) && (!is_object($$payment)) && (!$credit_covers) && ($customer_shopping_points_spending * REDEEM_POINT_VALUE < $order->info['total'] ) || (is_object($$payment) && ($$payment->enabled == false)) ) {

// if ( (is_array($payment_modules->modules)) && (sizeof($payment_modules->modules) > 1) && (!is_object($$payment)) && (!$credit_covers) && ($order->info['total'] > $customer_shopping_points_spending )) {

tep_redirect(tep_href_link(FILENAME_CHECKOUT_PAYMENT, 'error_message=' . urlencode(ERROR_NO_PAYMENT_MODULE_SELECTED), 'SSL'));
}
// customer can't use points over the order total         
 if ($customer_shopping_points_spending * REDEEM_POINT_VALUE > $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'));
}
///########  Points/Rewards  Module v1.00 EOF #################

 

I'm really gratefull for the help you bring to us!

 

Best regards!!!!! ;)


OSC2.2

Share this post


Link to post
Share on other sites
What can i say. this contribution is fantastic. I thought i say congratulations to deep-silver for writing this fantastic contribution,and to my programmer who installed it for me.

 

Is it me or does everyone encounter slow loading in Customers pomts when they move from page to poge? Its really really slow for me.

 

Also

 

Im still tryng to figure out if we should que customers ponts in table or not. Can anyone help?

 

Thanks

 

The programmer found out that a cardinal product was being made in the orders query causing bad performance as more customers and orders are added to the system.

The programmer decided to optimize this a little bit as follows , around lines 215, see the 2 lines of code commented out and replaced by a few more.

    while ($customers = tep_db_fetch_array($customers_query)) {
// BoF CB remove customers table and order by customer id
//     $info_query = tep_db_query("select o.customers_id, sum(op.products_quantity * op.final_price) as ordersum from " . TABLE_CUSTOMERS . " c, " . TABLE_ORDERS_PRODUCTS . " op, " . TABLE_ORDERS . " o where o.customers_id = '" . (int)$customers['customers_id'] . "' and o.orders_id = op.orders_id group by c.customers_firstname ");
     $info_query = tep_db_query("select o.customers_id, sum(op.products_quantity * op.final_price) as ordersum from " . TABLE_ORDERS_PRODUCTS . " op, " . TABLE_ORDERS . " o where o.customers_id = '" . (int)$customers['customers_id'] . "' and o.orders_id = op.orders_id group by o.customers_id ");
//EoF CB
     $info = tep_db_fetch_array($info_query);

     if ((!isset($HTTP_GET_VARS['cID']) || (isset($HTTP_GET_VARS['cID']) && ($HTTP_GET_VARS['cID'] == $customers['customers_id']))) && !isset($cInfo)) {
       $pending_query = tep_db_query("select count(*) as number_of_points_pending from " . TABLE_CUSTOMERS_POINTS_PENDING . " where status = 1 and customer_id = '" . (int)$customers['customers_id'] . "'");
//        $pending_query = tep_db_query("select sum(points_pending) as number_of_points_pending from " . TABLE_CUSTOMERS_POINTS_PENDING . " where status = 1 and customer_id = '" . (int)$customers['customers_id'] . "' group by customer_id");
       $pending = tep_db_fetch_array($pending_query);

//BoF CB check if there is an info array
//   	 $cInfo_array = array_merge($customers, $pending, $info); 
       if (is_array($info)) { 
      	 $cInfo_array = array_merge($customers, $pending, $info); 
       } else {
         $cInfo_array = array_merge($customers, $pending);
       }
//EoF CB
       $cInfo = new objectInfo($cInfo_array);

 

Note, This is for version 1.00, I'm not sure if the latest version still has this flaw.


KEEP CALM AND CARRY ON

I do not use the responsive bootstrap version since i coded my responsive version earlier, but i have bought every 28d of code package to support burts effort and keep this forum alive (albeit more like on life support).

So if you are still here ? What are you waiting for ?!

 

Find the most frequent unique errors to fix:

grep "PHP" php_error_log.txt | sed "s/^.* PHP/PHP/g" |grep "line" |sort | uniq -c | sort -r > counterrors.txt

Share this post


Link to post
Share on other sites
mujina what does the modification do? Thanks! I run CCGV as well

 

Maddie

 

Actually, without this modification a customer can complete the order even if he hasn't choosed a payment method. It is a pb that I encountered... not sure it is the same for people out there.


OSC2.2

Share this post


Link to post
Share on other sites

thank you for telling me mine seems to work ok without it... payment must be checked but thanks for the heads up!

Share this post


Link to post
Share on other sites
The programmer found out that a cardinal product was being made in the orders query causing bad performance as more customers and orders are added to the system.

The programmer decided to optimize this a little bit as follows , around lines 215, see the 2 lines of code commented out and replaced by a few more.

Note, This is for version 1.00, I'm not sure if the latest version still has this flaw.

Thank you for this .

To all of you please note that the above refred to catalog/admin/customers_points.php (start aprox line no.217 to 226).

I've tested it and It is safe to do the modification to the file.

As my test return the same result of page loading , I really can't promiss you that it will boost up your customers_points.php as it very much depending on the server loads and the total amount of customers you have. as customers points is loading all customers not only the one that has point. at the same time it check to see how many orders the customers made as well as if any order as pending points.(this part not really needed but i added it just to avoid giving points to a customer and then find out that he acutally had point but they where pending).

and this is to allow you to give points to those customers to try to push them to buy more.

Any way feel free to try this as it might speet up YOUR page loading and maybe will have no affact to other using this module.

If by any chance any one of you using this modification and feels that the page loads faster please let me know so i can upload a modify version to the contributions page just for those who can't handle a manual modification them self.


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

Share this post


Link to post
Share on other sites

@deep-silver:

This is one hell of an awesome contribution which installs easily despite it's complexity. You have done a great job with this :thumbsup:

 

I have installed it (v1.10) yesterday in my test shop and really want to get this live asap despite the fact my merchandise might not be the most logic one to offer this kind of feature :D

A few thing I encountered you might look at for your next release:

- Two language defines for the product_info.php are not mentioned in the install, TEXT_PRODUCT_POINTS and TEXT_PRODUCT_POINTS_VALUE, and are therefore missing on the product pages.

- There is one hard coded language sentence left inside the catalog/includes/modules/order_total/ot_redemptions.php

      $this->output[] = array('title' => 'Shopping Points Redeemed (' . $customer_shopping_points_spending . ' x ' .$currencies->format(REDEEM_POINT_VALUE, true, $order->info['currency'], $order->info['currency_value']) . '):',

I made a language define for 'Shopping Points Redeemed' and it's fine.

- On the product pages, if you activated showing the points and values there, the value is shown but the amount of points is not shown at all.

 

Earlier this week I installed TotalB2B and I am not sure if the last remark has anything to do with that but I'll have to look into that anyway as the points are now rewarded on the original price and not on the deducted customer price (I hope I can make these two working together).

 

Something I don't quite understand is how the activation of the points works. When I make a test order the earned points are waiting for validation. Then I click add points for the order to validate them but that doesn't happen rightaway. Only after I change the order status for at least one time (doesn't matter to what status) the points are final. Maybe this is how it should be ?!

 

Some suggestions:

- On the customer account points and reward page only the value is shown. It would be nice to show the actual points also

- On the same page I get some rows which shows, if I am correct, only the points earned with the order. For a complete oversight it would be nice to show a row also for the points spend for that particular order

 

As said, wonderful job !!

 

Ciao,

Howard

Share this post


Link to post
Share on other sites
A few thing I encountered you might look at for your next release:

- Two language defines for the product_info.php are not mentioned in the install, TEXT_PRODUCT_POINTS and TEXT_PRODUCT_POINTS_VALUE, and are therefore missing on the product pages

 

Thank you for that.

I missed up this step while modifiying installation instrctions. i also had to fix up the spam things on the test shop. im sos sorry for that and will post a correct installation instrctions without waiting for next version.

 

Something I don't quite understand is how the activation of the points works. When I make a test order the earned points are waiting for validation. Then I click add points for the order to validate them but that doesn't happen rightaway. Only after I change the order status for at least one time (doesn't matter to what status) the points are final. Maybe this is how it should be ?!

 

in admin/customers pending points you have to confirm the points only after you

send the order and you received the money for it.

Once you confirm that points , customer point account will be updated. if you choose to quie databse you will be adding a row for this customer and it will stay there untill you remove it. it bild iwht this option for stores that have a lot of customers so if you keep all records for points that already approved your database will grow and use space in your sql server. but if you don't worry about that go ahead and quie all pending points as your customers will be happy.

 

On the customer account points and reward page only the value is shown. It would be nice to show the actual points also

 

the reason i made it this way becouse as sales way of thinking, to show customers

how many points and orders total, is like saying "WOW look how much many you spent at our store, and maybe you should consider spending less"

 

Belive me you don't want to say that, what the module is saying is" WOW look how much cash back you earn so far so shopping at our store is not a bad idea after all"

On the same page I get some rows which shows, if I am correct, only the points earned with the order. For a complete oversight it would be nice to show a row also for the points spend for that particular order

from the same reason you have the choice of quieing database.

customers redeemed points are already recorded at the history page for that order so i see no points showing it again


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

Share this post


Link to post
Share on other sites
Actually, without this modification a customer can complete the order even if he hasn't choosed a payment method. It is a pb that I encountered... not sure it is the same for people out there.

thats not true as this module will NOT allow you to check out if he hasn't choosed a payment method. and the test shop will prove it.

YOU had to do this modification as you are using GV module with the latest post

in regard to check for error. many stores use GV module even if its still subject to lots of bugs.

GV module used to show errors in red line above all in checkout payment page but now when someone made a change to it and its now shwoing errors like the way credit card errors show up. so its been forsted to be treated as payment method while as points/rewards they both not a reall payment as a reall payment should hold a *.payment.php and ot_*.php so as long as GV has NO gv.php in payment module for me its not a payment.

by forsing GV to treated as payment you had to modify / replace so many files

and the result are that evreyone has a diffarent check out procces.

The line that you refer to is the line that will return the error for the payment method . consider it as a gate orders that passed this get will be able to complete

checkout procses.

IF this change work for you thats great .

BUT please remember that not all oscommerce users have GV installed (and even if they do not necessry exactly like yours) so the installation instrctions i wrote refer to a fresh install once you have made change to your files you will have to find your way to marge this contributions with your corrent.

P.S= im not here to support GV module i have enough supporting mine.


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

Share this post


Link to post
Share on other sites
Thank you for that.

I missed up this step while modifiying installation instrctions.  i also had to fix up the spam things on the test shop. im sos sorry for that and will post a correct installation instrctions without waiting for next version.

in admin/customers pending points you have to confirm the points only after you

send the order and you received the money for it.

Once you confirm that points , customer point account will be updated. if you choose to quie databse you will be adding a row for this customer and it will stay there untill you remove it. it bild iwht this option for stores that have a lot of customers so if you keep all records for points that already approved your database will grow and use space in your sql server. but if you don't worry about that go ahead and quie all pending points as your customers will be happy.

the reason i made it this way becouse as sales way of thinking, to show customers

how many points and orders total, is like saying "WOW look how much many you spent at our store, and maybe you should consider spending less"

 

Belive me you don't want to say that, what the module is saying is" WOW look how much cash back you earn so far so shopping at our store is not a bad idea after all"

 

from the same reason you have the choice of quieing database.

customers redeemed points are already recorded at the history page for that order so i see no points showing it again

 

Hello deep-silver,

 

Thanks for your fast reply !

Maybe I should clarify a bit better what I meant with the suggestions.

If you look at this picture (writing in Dutch but you'll grasp what it tells)

wotsbalans1.jpg

 

As a customer I only see the value of my points left and knowing the amount of points would be nice as as a customer I don't have the conversion rate right into my mind. I don't quite understand what it would be bad to show the amount of points left also ?

Something like xx.xx EUR (= 50 points)

 

Also an extra row for showing the amount of points spend on the order wouldn't hurt that much I guess. You are right that it shows on the order history pages but opening one and each of these to take a look at the points spend is not what I would like as a customer. Afterall it is a balance and showing all incoming and outgoing points is what I would like to see as a customer. As the page only shows points I don't think a customer will be daunted by it and think 'wow, I really should spend less'.

 

Anyhow, just my thoughts. It is way cool as it is now anyway !

 

Howard

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

×