Forums / All Other Contributions/Addons / Reward Points Module for ZC v13x

Reward Points Module for ZC v13x

Locked

Views: 472,161

Results 2,461 to 2,476 of 2,476
This thread is locked. New replies are disabled.
5 Nov 2014, 9:51 PM
#2461
countrycharm avatar

countrycharm

Totally Zenned

Join Date:
Jul 2007
Posts:
2,179
Plugin Contributions:
2

Reward Points Module for ZC v13x

dix30simulation:

Hello,

Great module but have 2 issues:

1: looks like the module didn't load up correctly. Shouldn't it be written "Reward Point" instead of PRODUCT_REWARD_POINT_TAG on each product reward title?
Did 2 clean install, yet with the same issue. Don't mind to edit it manually if someone can tell me which file pls.

#point PRODUCT_REWARD_POINT_TAG (underneath each product title) :lookaroun

2: when an order is made, Reward point are set to zero on the admin order page, however, when I load the invoice, rewards appear as well as in the reward pending/earned page. Missing something?

all files have been uploaded correctly to my FTP even twice.

All comments appreciated

Thanks,

Dan

1.) A link to your site would be nice....
2.) When looking or editing a order reward points does not show the points. It shows 0. The reward points changes from pending to earn when a order status is change. The reward point will show on the invoice and order emails.

The reason the reward points in admin/customers/orders/edit order will not show is because, the reward points is different with the total of,
100 points = $1 so the reward points can not save the points value in database so you see it's 0.00

Check the orders_totals table and you will understand whats going on.

I know it is hard to understand but that's the best I can explain it.

Is your site Upgraded to the current version 1.5.4 Yet?
zencart-upgrades-website-installation

6 Nov 2014, 3:13 AM
#2462
dix30simulation avatar

dix30simulation

New Zenner

Join Date:
Aug 2012
Location:
Montreal, Canada
Posts:
30
Plugin Contributions:
0

Re: Reward Points Module for ZC v13x

Thanks for your prompt return,

feel free to browse any article on https://www.dix30simulation.com, Module works well, just the "title" that does not load. File missing or not loaded I can guess.

Also I do not see the any Layout Box Controller in my list to activate, yet all the files have been loaded carefully...

6 Nov 2014, 3:45 PM
#2463
countrycharm avatar

countrycharm

Totally Zenned

Join Date:
Jul 2007
Posts:
2,179
Plugin Contributions:
2

Re: Reward Points Module for ZC v13x

dix30simulation:

Thanks for your prompt return,

feel free to browse any article on www.dix30simulation.com, Module works well, just the "title" that does not load. File missing or not loaded I can guess.

Also I do not see the any Layout Box Controller in my list to activate, yet all the files have been loaded carefully...

Check and make sure the custom folder name is changed to the template name you are using o_canada. Check to make sure includes\languages\english\extra_definitionscustom folder is change to your template name o_canada. Your problem is you haven't change the custom folder reward points uses to o_canada your template name. Once you change the name re-upload reward points.

This is why there is no sideboxes to activate.

You have to change all folders with the name custom on them to your template name.

Is your site Upgraded to the current version 1.5.4 Yet?
zencart-upgrades-website-installation

6 Nov 2014, 8:23 PM
#2464
dix30simulation avatar

dix30simulation

New Zenner

Join Date:
Aug 2012
Location:
Montreal, Canada
Posts:
30
Plugin Contributions:
0

Re: Reward Points Module for ZC v13x

All good with the title, thank you! although the side box still not show even after a fresh new uninstall/install of files + .sql, not a big deal.

6 Nov 2014, 9:16 PM
#2465
countrycharm avatar

countrycharm

Totally Zenned

Join Date:
Jul 2007
Posts:
2,179
Plugin Contributions:
2

Re: Reward Points Module for ZC v13x

dix30simulation:

All good with the title, thank you! although the side box still not show even after a fresh new uninstall/install of files + .sql, not a big deal.

It's a big deal if you want your customers to know what points they have earned.
Did you change the custom sideboxes folder name includes\modules\sideboxes\custom to o_canada. That is the reason they are not showing unless you haven't activated them in admin/tools/layout boxes.

Is your site Upgraded to the current version 1.5.4 Yet?
zencart-upgrades-website-installation

11 Jan 2015, 7:14 AM
#2466
winchees avatar

winchees

New Zenner

Join Date:
Dec 2014
Location:
Auckland, New Zealand
Posts:
11
Plugin Contributions:
0

Re: Reward Points Module for ZC v13x

Hi I was wondering if some one can help with an issue I am having

Have install mod & works great except issue I am having with redeeming points.

Issue is this: customer purchases product & gets 100 points for product purchased. On same transaction uses points earned ($ value $10) which I am findinding deducts of the purchase price so they end up only earning 90 points EG: see attached file

Attachment 14853

As we claim on the site (test site at moment) that they always get full $value on their purchases this doesn't work. Having no issues with the mod at all except for this issue

I would appreciate it if anyone would advise if they have had a similar problem and how they resolved it.

11 Jan 2015, 11:53 PM
#2467
madpricersales avatar

madpricersales

New Zenner

Join Date:
Jul 2006
Posts:
60
Plugin Contributions:
0

Re: Reward Points Module for ZC v13x

Winchees:

Hi I was wondering if some one can help with an issue I am having

Have install mod & works great except issue I am having with redeeming points.

Issue is this: customer purchases product & gets 100 points for product purchased. On same transaction uses points earned ($ value $10) which I am findinding deducts of the purchase price so they end up only earning 90 points EG: see attached file

Attachment 14853

As we claim on the site (test site at moment) that they always get full $value on their purchases this doesn't work. Having no issues with the mod at all except for this issue

I would appreciate it if anyone would advise if they have had a similar problem and how they resolved it.

go into your admin and click on configuration, scroll down to reward point configuration and click on it. Look at reward point mode the first option and make sure that you have option 0 checked, That should fix it.

14 Jan 2015, 5:11 AM
#2468
winchees avatar

winchees

New Zenner

Join Date:
Dec 2014
Location:
Auckland, New Zealand
Posts:
11
Plugin Contributions:
0

Re: Reward Points Module for ZC v13x

MadPricerSales:

go into your admin and click on configuration, scroll down to reward point configuration and click on it. Look at reward point mode the first option and make sure that you have option 0 checked, That should fix it.

Hi, thanks for the help.

I have tried this & issue is still happening - would appreciate it if anyone has any other ideas

2 Mar 2015, 12:34 PM
#2469
abcisme avatar

abcisme

Zen Follower

Join Date:
Jun 2006
Posts:
298
Plugin Contributions:
0

Re: Reward Points Module for ZC v13x

abcisme:

Ok, I am not a programmer, so I am taking a stab in the dark at this.. but looking at the housekeeping function, if I create a subset for housekeeping which specifies earned points instead of pending points.. then switched the housekeeping function to reflect rewards_points instead of pending_points, it should work to remove any earned points instead of pending points. Right?

So pending points will switch to earned after the sunrise period, then be removed after the housekeeping period... Does this look correct?

function CleanupRewardPointHistory()
{
global $db,$messageStack;

$subset="IFNULL((SELECT SUM(rp.reward_points) FROM ".TABLE_REWARD_STATUS_TRACK." rp WHERE cp.customers_id=rp.customers_id AND rp.status='".STATUS_PENDING."' AND rp.date<NOW()-INTERVAL %s DAY),0)";

$subset2="IFNULL((SELECT SUM(rp.reward_points) FROM ".TABLE_REWARD_STATUS_TRACK." rp WHERE cp.customers_id=rp.customers_id AND rp.status='".STATUS_PROCESSED."' AND rp.date<NOW()-INTERVAL %s DAY),0)";
$sunrise_subset=sprintf($subset,REWARD_POINTS_SUNRISE_PERIOD);
$housekeeping_subset=sprintf($subset2,REWARD_POINTS_HOUSEKEEPING);

if(REWARD_POINTS_SUNRISE_PERIOD>0)
 if($db->Execute("UPDATE ".TABLE_REWARD_CUSTOMER_POINTS." cp, ".TABLE_REWARD_STATUS_TRACK." rp SET cp.reward_points=cp.reward_points+".$sunrise_subset.",cp.pending_points=cp.pending_points-".$sunrise_subset." WHERE cp.customers_id=rp.customers_id;"))
  $db->Execute("UPDATE ".TABLE_REWARD_STATUS_TRACK." SET status=".STATUS_PROCESSED." WHERE status=".STATUS_PENDING." AND date<NOW()-INTERVAL ".REWARD_POINTS_SUNRISE_PERIOD." DAY;");
 
if(REWARD_POINTS_HOUSEKEEPING>0)

if($db->Execute("UPDATE ".TABLE_REWARD_CUSTOMER_POINTS." cp, ".TABLE_REWARD_STATUS_TRACK." rp SET cp.reward_points=cp.reward_points-".$housekeeping_subset." WHERE cp.customers_id=rp.customers_id;"))

  $db->Execute("DELETE FROM ".TABLE_REWARD_STATUS_TRACK." WHERE date<NOW()-INTERVAL ".(int)REWARD_POINTS_HOUSEKEEPING." DAY;");

}


So I guess I've messed up somewhere here.  I'm hoping someone can help me figure this out.

I want to:
zen_reward_customer_points.reward_points - zen_reward_status_track.reward_points
WHEN
zen_reward_status_track date > 104 days ago
AND
zen_reward_status_track.customer_id = zen_reward_customer_points.customer_id

Then, I want to delete the record from zen_reward_status_track

Here's what I currently have:

$subset2="IFNULL((SELECT SUM(rp.reward_points) FROM ".TABLE_REWARD_STATUS_TRACK." rp WHERE cp.customers_id=rp.customers_id AND rp.status='1' AND rp.date<NOW()-INTERVAL 104 DAY),0)";

$housekeeping_subset=sprintf($subset2,REWARD_POINTS_HOUSEKEEPING);

if(REWARD_POINTS_HOUSEKEEPING>0)

if($db->Execute("UPDATE ".TABLE_REWARD_CUSTOMER_POINTS." cp, ".TABLE_REWARD_STATUS_TRACK." rp SET cp.reward_points=cp.reward_points-".$housekeeping_subset." WHERE cp.customers_id=rp.customers_id;"))

$db->Execute("DELETE FROM ".TABLE_REWARD_STATUS_TRACK." WHERE date<NOW()-INTERVAL 104 DAY;");
}


This deletes the record from zen_reward_status_track, but doesn't delete the points from zen_reward_customer_points.reward_points

Can anyone help?
4 Mar 2015, 4:32 PM
#2470
giancalr avatar

giancalr

Zen Follower

Join Date:
Jul 2010
Location:
L'Aquila
Posts:
113
Plugin Contributions:
1

Re: Reward Points Module for ZC v13x

Hello everyone, I installed the module works all regularly, but when I go to update the order to give the points to the customer, those performed with payment paypla not update, while those made with bank payment or payment types eltri updates all , is there any change to do for payments with paypal? Thank you

Erboristeria La Spiga e Il Girasole Herbal Shop - https://www.erboristeriabio.com
Golden Eagle Herbal - https://www.erboristeriabio.it
Giraspiga - https://www.giraspiga.com

6 Mar 2015, 4:34 PM
#2471
giancalr avatar

giancalr

Zen Follower

Join Date:
Jul 2010
Location:
L'Aquila
Posts:
113
Plugin Contributions:
1

Re: Reward Points Module for ZC v13x

I find solution in oscommerce forum, as would fit in zen cart?
Open catalog/includes/modules/payment/paypal_standard.php

Find:

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

Replace with this:

Points/Rewards Module V2.00 balance customer points BOF

// global $cartID, $cart_PayPal_Standard_ID, $customer_id, $languages_id, $order, $order_total_modules;
global $cartID, $cart_PayPal_Standard_ID, $customer_id, $languages_id, $order, $customer_shopping_points, $customer_shopping_points_spending, $order_total_modules;

Points/Rewards Module V2.00 balance customer points EOF ####*/


Find:

         tep_db_perform(TABLE_ORDERS_TOTAL, $sql_data_array);
       }

Add after:

Points/Rewards Module V2.1rc2a balance customer points BOF

if ((USE_POINTS_SYSTEM == 'true') && (USE_REDEEM_SYSTEM == 'true')) {
// customer pending points added
if ($order->info['total'] > 0) {
$points_toadd = get_points_toadd($order);
$points_comment = 'TEXT_DEFAULT_COMMENT';
$points_type = 'SP';
if ((get_redemption_awards($customer_shopping_points_spending) == true) && ($points_toadd >0)) {
tep_add_pending_points($customer_id, $insert_id, $points_toadd, $points_comment, $points_type);
}
}
// customer referral points added
if ((tep_session_is_registered('customer_referral')) && (tep_not_null(USE_REFERRAL_SYSTEM))) {
$referral_twice_query = tep_db_query("select unique_id from " . TABLE_CUSTOMERS_POINTS_PENDING . " where orders_id = '". (int)$insert_id ."' and points_type = 'RF' limit 1");
if (!tep_db_num_rows($referral_twice_query)) {
$points_toadd = USE_REFERRAL_SYSTEM;
$points_comment = 'TEXT_DEFAULT_REFERRAL';
$points_type = 'RF';
tep_add_pending_points($customer_referral, $insert_id, $points_toadd, $points_comment, $points_type);
}
}
// customer shoppping points account balanced
if ($customer_shopping_points_spending) {
tep_redeemed_points($customer_id, $insert_id, $customer_shopping_points_spending);
}
}

Points/Rewards Module V2.1rc2a balance customer points EOF ####*/


Find:

   tep_session_unregister('shipping');
   tep_session_unregister('payment');
   tep_session_unregister('comments');

Add after:

  tep_session_unregister('customer_shopping_points');// Points/Rewards  Module v1.10
  tep_session_unregister('customer_shopping_points_spending');// Points/Rewards  Module v1.10
  tep_session_unregister('customer_referral');// Points/Rewards Module V2.00

That's all

Erboristeria La Spiga e Il Girasole Herbal Shop - https://www.erboristeriabio.com
Golden Eagle Herbal - https://www.erboristeriabio.it
Giraspiga - https://www.giraspiga.com

7 Mar 2015, 6:28 PM
#2472
divavocals avatar

divavocals

Totally Zenned

Join Date:
Jan 2007
Location:
Los Angeles, California, United States
Posts:
10,011
Plugin Contributions:
3

Re: Reward Points Module for ZC v13x

Two points..

  1. All those "tep_db_*" functions are OS Commerce functions.. (as is this code..) I hope you are aware that you can't just drop this into the Zen Cart module..
  2. If the issue you are having is with PayPal Standard, disable it, and activate PayPal Express, and see if the issue persists..

My Site - Zen Cart & WordPress integration specialist
I don't answer support questions via PM. Post add-on support questions in the support thread. The question & the answer will benefit others with similar issues.

9 Mar 2015, 8:51 AM
#2473
giancalr avatar

giancalr

Zen Follower

Join Date:
Jul 2010
Location:
L'Aquila
Posts:
113
Plugin Contributions:
1

Re: Reward Points Module for ZC v13x

Thanks for the answer, but I had asked if there was a solution for zen cart, and or adapt the query to the DB zen, and I will not turn paypal express. Thank you

Erboristeria La Spiga e Il Girasole Herbal Shop - https://www.erboristeriabio.com
Golden Eagle Herbal - https://www.erboristeriabio.it
Giraspiga - https://www.giraspiga.com

9 Mar 2015, 1:02 PM
#2474
divavocals avatar

divavocals

Totally Zenned

Join Date:
Jan 2007
Location:
Los Angeles, California, United States
Posts:
10,011
Plugin Contributions:
3

Re: Reward Points Module for ZC v13x

giancalr:

Thanks for the answer, but I had asked if there was a solution for zen cart, and or adapt the query to the DB zen, and I will not turn paypal express. Thank you

Right.. so let me put it another way.. Outside of Rewards Points, the PayPal Standard module has ISSUES in general.. and the recommended solution for all of those issues is to NOT use PayPal Standard ever, and use PayPal Express module.. So, it is possible that your issue will go away if you simply turn on the PayPal Express module.. If you choose not to that is certainly your choice.. but you should know the issue you report is not a known issue with Rewards Points, which leads me to believe that the issue could be resolved by simply using PayPal Express vs PayPal Standard..

As for the code you posted, if a community member knows how to convert that osCommerce code, hopefully they will share their solution.. otherwise you could look for a developer to help you with that..

Happy Zenning..

My Site - Zen Cart & WordPress integration specialist
I don't answer support questions via PM. Post add-on support questions in the support thread. The question & the answer will benefit others with similar issues.

13 Mar 2015, 6:05 PM
#2475
southshorepizza avatar

southshorepizza

Zen Follower

Join Date:
Sep 2012
Posts:
253
Plugin Contributions:
0

Re: Reward Points Module for ZC v13x

I have a question on customization. Not confident enough to through this up on a live site. Unfortunately we are in a slow move from one server to the next. But with free migration I can't complain.
Anyways I want to not write points to the table_reward_customer_points if the email address contains a certain domain. I'm pretty sure I would change the catalog/includes/functions/extra_functions/reward_points_functions.php file. Specifically

function UpdateCustomerRewardPoints($customer_id,$reward_points,$pending_points)
{
	global $db;

	$sql="INSERT INTO ".TABLE_REWARD_CUSTOMER_POINTS." VALUES ('".$customer_id."', '".$reward_points."', '".$pending_points."') ON DUPLICATE KEY UPDATE reward_points=reward_points+".$reward_points.", pending_points=pending_points+".$pending_points.";";
	$db->Execute($sql);
}

I'm thinking something like

function UpdateCustomerRewardPoints($customer_id,$reward_points,$pending_points)
{
	global $db;
       if (strpos($order->info['customer_email_address'],'@domain.com') == false) {
    $sql="INSERT INTO ".TABLE_REWARD_CUSTOMER_POINTS." VALUES ('".$customer_id."', '".$reward_points."', '".$pending_points."') ON DUPLICATE KEY UPDATE reward_points=reward_points+".$reward_points.", pending_points=pending_points+".$pending_points.";";
	$db->Execute($sql);
}	
} 

Can someone verify my logic here and let me know if I'm on the right track? Is the variable "$order->info['customer_email_address']" even available at this point? Thank you.

15 Mar 2015, 11:29 PM
#2476
divavocals avatar

divavocals

Totally Zenned

Join Date:
Jan 2007
Location:
Los Angeles, California, United States
Posts:
10,011
Plugin Contributions:
3

Re: Reward Points Module for ZC v13x

southshorepizza:

I have a question on customization. Not confident enough to through this up on a live site. Unfortunately we are in a slow move from one server to the next. But with free migration I can't complain.
Anyways I want to not write points to the table_reward_customer_points if the email address contains a certain domain. I'm pretty sure I would change the catalog/includes/functions/extra_functions/reward_points_functions.php file. Specifically

function UpdateCustomerRewardPoints($customer_id,$reward_points,$pending_points)
{
global $db;

$sql="INSERT INTO ".TABLE_REWARD_CUSTOMER_POINTS." VALUES ('".$customer_id."', '".$reward_points."', '".$pending_points."') ON DUPLICATE KEY UPDATE reward_points=reward_points+".$reward_points.", pending_points=pending_points+".$pending_points.";";
$db->Execute($sql);

}

> I'm thinking something like 
> ```
function UpdateCustomerRewardPoints($customer_id,$reward_points,$pending_points)
{
    global $db;
       if (strpos($order->info['customer_email_address'],'@domain.com') == false) {
    $sql="INSERT INTO ".TABLE_REWARD_CUSTOMER_POINTS." VALUES ('".$customer_id."', '".$reward_points."', '".$pending_points."') ON DUPLICATE KEY UPDATE reward_points=reward_points+".$reward_points.", pending_points=pending_points+".$pending_points.";";
    $db->Execute($sql);
}    
} 

Can someone verify my logic here and let me know if I'm on the right track? Is the variable "$order->info['customer_email_address']" even available at this point? Thank you.

I don't have an answer as much as a suggestion which has helped me get answers to things.. Create a clone of your live site to use as your test bed.. That way you can test your code and if it works, you share..:laugh: and if it doesn't, then you can say, "this is what I tried".. "this is the result"..

My Site - Zen Cart & WordPress integration specialist
I don't answer support questions via PM. Post add-on support questions in the support thread. The question & the answer will benefit others with similar issues.