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

Reward Points Module for ZC v13x

Locked

Views: 470,663

Results 1,521 to 1,540 of 2,476
This thread is locked. New replies are disabled.
29 Jul 2010, 12:55 PM
#1521
unicorn avatar

unicorn

Zen Follower

Join Date:
Sep 2008
Posts:
107
Plugin Contributions:
0

Reward Points Module for ZC v13x

hem:

Would a better idea be to display something like "If you had an account you would have earned X reward points on this purchase". That would encourage more people to create an account with you.

How about removing the reference to the bonus points from order total alltogether, would that work..? The customer would see the points in the sidebar box when logged in... And then maybe just have general info on reward points on main page or on page 4 or something.

29 Jul 2010, 3:56 PM
#1522
damiantaylor avatar

damiantaylor

Zen Follower

Join Date:
Aug 2009
Posts:
244
Plugin Contributions:
0

Re: Reward Points Module for ZC v13x

If anyone is wanting to display a different message for COWOA custmers, here's how I did it...as for having a negative impact, I haven't noticed.
In fact, I have had customers sign up for a full account and ask if they can have their points from their COWOA order, which I'm always glad to do!
The good thing about this mod is the points do get stored against the COWOA order so you can see how many points to transfer across to the full account.

Add the following defines to file includes/languages/english/modules/order_total/ot_reward_points_display.php

define('MODULE_ORDER_TOTAL_REWARD_POINTS_DISPLAY_COWOA_TITLE', 'With a full account, you could have earned');
define('MODULE_ORDER_TOTAL_REWARD_POINTS_DISPLAY_COWOA_TAG', 'points!');
define('FONT_RED','<font color="red">');
define('UNFONT','</font>');

Add the code below shown in red to function process() in file includes/modules/order_total/ot_reward_points_display.php

    function process() 
	{
		global $order;

		$reward_points=GetRewardPoints($order->products);
		
		$GlobalRewardPointRatio=GetGlobalRewardPointRatio();
		$AdjustValue=GetRewardPointAdvancedCalculateValue();
		$reward_points+=$AdjustValue*$GlobalRewardPointRatio;
		
		if(isset($_SESSION['redeem_value']))
		{
			/*
			$redeem_ratio=GetRedeemRatio($_SESSION['customer_id']);
			$reward_points=$reward_points/$redeem_ratio;
			$reward_points=$reward_points-$_SESSION['redeem_value'];
			$reward_points=$reward_points*$redeem_ratio;
			*/
			$reward_points=$reward_points-($GlobalRewardPointRatio*$_SESSION['redeem_value']);
		}

		if($reward_points<0)
		 $reward_points=0;
		
		$reward_points=zen_round($reward_points,0);
		$_SESSION['REWARD_POINTS_EARNED']=$reward_points;
		
		if ($_SESSION['COWOA']) {
		 $this->output[] = array('title' => FONT_RED . MODULE_ORDER_TOTAL_REWARD_POINTS_DISPLAY_COWOA_TITLE . ' ' . $reward_points . ' ' . MODULE_ORDER_TOTAL_REWARD_POINTS_DISPLAY_COWOA_TAG . UNFONT,
                               'text' => '',
                               'value' => 0);
		} else {
		 $this->output[] = array('title' => $this->title . ':',
                               'text' => $reward_points,
                               'value' => 0);
		}
    }
29 Jul 2010, 8:47 PM
#1523
hem avatar

hem

Totally Zenned

Join Date:
Sep 2007
Location:
Dublin, Ireland
Posts:
1,281
Plugin Contributions:
5

Re: Reward Points Module for ZC v13x

damiantaylor:

If anyone is wanting to display a different message for COWOA custmers, here's how I did it...as for having a negative impact, I haven't noticed.
In fact, I have had customers sign up for a full account and ask if they can have their points from their COWOA order, which I'm always glad to do!
The good thing about this mod is the points do get stored against the COWOA order so you can see how many points to transfer across to the full account.

Nice one Damian- Do you mind if I include that in the mod as a supplemental addon?

30 Jul 2010, 9:20 AM
#1524
unicorn avatar

unicorn

Zen Follower

Join Date:
Sep 2008
Posts:
107
Plugin Contributions:
0

Re: Reward Points Module for ZC v13x

damiantaylor:

If anyone is wanting to display a different message for COWOA custmers, here's how I did it...

Thanks, but this just gave me a blank checkout_payment..?

30 Jul 2010, 9:51 AM
#1525
damiantaylor avatar

damiantaylor

Zen Follower

Join Date:
Aug 2009
Posts:
244
Plugin Contributions:
0

Re: Reward Points Module for ZC v13x

Hi Andrew,
You can use that code, no problem.

Unicorn,
Are you using the latest version of the mod? If memory serves correctly I have 1.33a.
Does your original process() function look like this:

    function process() 
	{
		global $order;

		$reward_points=GetRewardPoints($order->products);
		
		$GlobalRewardPointRatio=GetGlobalRewardPointRatio();
		$AdjustValue=GetRewardPointAdvancedCalculateValue();
		$reward_points+=$AdjustValue*$GlobalRewardPointRatio;
		
		if(isset($_SESSION['redeem_value']))
		{
			/*
			$redeem_ratio=GetRedeemRatio($_SESSION['customer_id']);
			$reward_points=$reward_points/$redeem_ratio;
			$reward_points=$reward_points-$_SESSION['redeem_value'];
			$reward_points=$reward_points*$redeem_ratio;
			*/
			$reward_points=$reward_points-($GlobalRewardPointRatio*$_SESSION['redeem_value']);
		}

		if($reward_points<0)
		 $reward_points=0;
		
		$reward_points=zen_round($reward_points,0);
		$_SESSION['REWARD_POINTS_EARNED']=$reward_points;
		
		$this->output[] = array('title' => $this->title . ':',
                              'text' => $reward_points,
                              'value' => 0);
    }

A blank page usually means a php syntax error or an undefined field.

30 Jul 2010, 10:22 AM
#1526
unicorn avatar

unicorn

Zen Follower

Join Date:
Sep 2008
Posts:
107
Plugin Contributions:
0

Re: Reward Points Module for ZC v13x

damiantaylor:

Hi Andrew,
You can use that code, no problem.

Does your original process() function look like this:

A blank page usually means a php syntax error or an undefined field.

Yes, it does... May have gotten a synax error, though I cannot figure out where and why. I'll have another look at it! :)

30 Jul 2010, 6:37 PM
#1527
damiantaylor avatar

damiantaylor

Zen Follower

Join Date:
Aug 2009
Posts:
244
Plugin Contributions:
0

Re: Reward Points Module for ZC v13x

try commenting out the bit of added code, so the function would look like this:

    function process() 
	{
		global $order;

		$reward_points=GetRewardPoints($order->products);
		
		$GlobalRewardPointRatio=GetGlobalRewardPointRatio();
		$AdjustValue=GetRewardPointAdvancedCalculateValue();
		$reward_points+=$AdjustValue*$GlobalRewardPointRatio;
		
		if(isset($_SESSION['redeem_value']))
		{
			/*
			$redeem_ratio=GetRedeemRatio($_SESSION['customer_id']);
			$reward_points=$reward_points/$redeem_ratio;
			$reward_points=$reward_points-$_SESSION['redeem_value'];
			$reward_points=$reward_points*$redeem_ratio;
			*/
			$reward_points=$reward_points-($GlobalRewardPointRatio*$_SESSION['redeem_value']);
		}

		if($reward_points<0)
		 $reward_points=0;
		
		$reward_points=zen_round($reward_points,0);
		$_SESSION['REWARD_POINTS_EARNED']=$reward_points;
/*	
		if ($_SESSION['COWOA']) {
		 $this->output[] = array('title' => FONT_RED . MODULE_ORDER_TOTAL_REWARD_POINTS_DISPLAY_COWOA_TITLE . ' ' . $reward_points . ' ' . MODULE_ORDER_TOTAL_REWARD_POINTS_DISPLAY_COWOA_TAG . UNFONT,
                               'text' => '',
                               'value' => 0);
		} else {
*/
		 $this->output[] = array('title' => $this->title . ':',
                               'text' => $reward_points,
                               'value' => 0);
//		}
    }

If that works, I think it must be one of the defines that hasn't been defined:

FONT_RED
MODULE_ORDER_TOTAL_REWARD_POINTS_DISPLAY_COWOA_TITLE
MODULE_ORDER_TOTAL_REWARD_POINTS_DISPLAY_COWOA_TAG 
UNFONT
30 Jul 2010, 6:47 PM
#1528
leilanddale avatar

leilanddale

New Zenner

Join Date:
Jan 2010
Posts:
69
Plugin Contributions:
0

Re: Reward Points Module for ZC v13x

hem:

I tested it here and it is working exactly as it should- No payment method is being asked for on purchases with a zero total. Are you using any other checkout mod that might be causing this?

The only other payment methods I'm using are 2Checkout and PayPal Express.

2 Aug 2010, 9:46 AM
#1529
digitalshadow avatar

digitalshadow

Totally Zenned

Join Date:
Mar 2009
Posts:
616
Plugin Contributions:
0

Re: Reward Points Module for ZC v13x

I updated my order status using super orders batch update and none of the orders have had their points moved from pending to earned.

I'm using Advanced which state Pend: [Order Processing] Earn: [Order Completed]

Why haven't the points updated.

2 Aug 2010, 6:01 PM
#1530
darrenq avatar

darrenq

New Zenner

Join Date:
Apr 2010
Posts:
78
Plugin Contributions:
0

Re: Reward Points Module for ZC v13x

Hi i was wondering if anybody had an answer to this problem.

I am trying to change the message for reward points shown in the product page. at the moment it says "33 reward points"
However i would like it to display as "Worth 33 Reward Points"

How can i move the Number of points?

So far i have tried changing the tpl_products_reward_points.php code to this;

echo PRODUCT_REWARD_POINT_TAG.' '.$reward_points' 'PRODUCT_REWARD_POINT_TAG_1.;

and added 'PRODUCT_REWARD_POINT_TAG_1.; into the reward_points.php in the extra definitions directory.

But this doesn't seem to work. I just blanks my page. If i remove the last 'PRODUCT_REWARD_POINT_TAG_1.; from the line in tpl it works again. What am i missing?

3 Aug 2010, 9:29 AM
#1531
damiantaylor avatar

damiantaylor

Zen Follower

Join Date:
Aug 2009
Posts:
244
Plugin Contributions:
0

Re: Reward Points Module for ZC v13x

try

echo PRODUCT_REWARD_POINT_TAG . ' ' . $reward_points . ' ' . PRODUCT_REWARD_POINT_TAG_1;
3 Aug 2010, 5:00 PM
#1532
lauriesscraps avatar

lauriesscraps

Zen Follower

Join Date:
Sep 2009
Posts:
255
Plugin Contributions:
0

Re: Reward Points Module for ZC v13x

I recently updated my reward points module to the new version and it wiped all my reward points that I had in my store already. Hem mentioned that I can restor the sql tables and they will all come back, but I do not know where these are to restore them. I did back up my site before I did that so are the sql tables you are referring to in the back up files somewhere? If so, can someone tell me exactly where they are found in the system files so I can restore them?

Also, the reward points are no longer being shown on the product description pages. Is this something that is new with the updated module? If so that is fine, I just was afraid that I had done something wrong.

Thanks in advance to anyone that can help me. And thanks to hem for putting up with me up till now.

Laurie

4 Aug 2010, 5:38 AM
#1533
lauriesscraps avatar

lauriesscraps

Zen Follower

Join Date:
Sep 2009
Posts:
255
Plugin Contributions:
0

Re: Reward Points Module for ZC v13x

Can anybody help me with my problem? Does anybody know how I can restore my erased reward points through restoring the sql tables?

Thank you in advance.

4 Aug 2010, 9:24 AM
#1534
hem avatar

hem

Totally Zenned

Join Date:
Sep 2007
Location:
Dublin, Ireland
Posts:
1,281
Plugin Contributions:
5

Re: Reward Points Module for ZC v13x

Laurie- you should have three SQL tables backed up: reward_customer_points.sql, reward_status_track.sql and reward_master.sql (they might have zen_ prepended to the names if you use that option in ZenCart). If you run these using Admin->Tools->SQL Patch, that will reload the tables with the backed up data.

4 Aug 2010, 9:26 AM
#1535
hem avatar

hem

Totally Zenned

Join Date:
Sep 2007
Location:
Dublin, Ireland
Posts:
1,281
Plugin Contributions:
5

Re: Reward Points Module for ZC v13x

DarrenQ:

Hi i was wondering if anybody had an answer to this problem.

I am trying to change the message for reward points shown in the product page. at the moment it says "33 reward points"
However i would like it to display as "Worth 33 Reward Points"

How can i move the Number of points?

So far i have tried changing the tpl_products_reward_points.php code to this;

echo PRODUCT_REWARD_POINT_TAG.' '.$reward_points' 'PRODUCT_REWARD_POINT_TAG_1.;

> 
> and added 'PRODUCT_REWARD_POINT_TAG_1.; into the reward_points.php in the extra definitions directory.
> 
> But this doesn't seem to work. I just blanks my page. If i remove the last 'PRODUCT_REWARD_POINT_TAG_1.; from the line in tpl it works again. What am i missing?

Remove the full stop from after PRODUCT_REWARD_POINT_TAG
4 Aug 2010, 9:35 AM
#1536
hem avatar

hem

Totally Zenned

Join Date:
Sep 2007
Location:
Dublin, Ireland
Posts:
1,281
Plugin Contributions:
5

Re: Reward Points Module for ZC v13x

DigitalShadow:

I updated my order status using super orders batch update and none of the orders have had their points moved from pending to earned.

I'm using Advanced which state Pend: [Order Processing] Earn: [Order Completed]

Why haven't the points updated.

Is the other mod built on a version of Zencart earlier than v1.3.8? I have had issues in the past with Order based mods that rewrite the core orders.php file. Ones not based on v1.3.8 do not use the observer/notifier system so they never call the Reward Point functions.

To check, download the RPD (ftp://ftp.omnicia.com/rpd.zip) and extract the two files to the root of your store. Run this under your browser by typing "www.MY_STORE_ADDRESS.com/rpd.php" and check the final section (Special Rules Check). You should see the following:

Special Rules Check
Found ->notify('NOTIFY_ORDER_DURING_CREATE_ADDED_ORDER_HEADER' in includes/classes/order.php
Found ->notify('NOTIFY_MODULE_CREATE_ACCOUNT_ADDED_ in includes/modules/create_account.php
Found ->notify('NOTIFY_LOGIN_SUCCESS'); in includes/modules/pages/login/header_php.php

4 Aug 2010, 3:16 PM
#1537
lauriesscraps avatar

lauriesscraps

Zen Follower

Join Date:
Sep 2009
Posts:
255
Plugin Contributions:
0

Re: Reward Points Module for ZC v13x

hem:

Laurie- you should have three SQL tables backed up: reward_customer_points.sql, reward_status_track.sql and reward_master.sql (they might have zen_ prepended to the names if you use that option in ZenCart). If you run these using Admin->Tools->SQL Patch, that will reload the tables with the backed up data.

I tried looking for these files and I am not seeing them. Even did a file search for them. Where would they be located? Sorry to bother again. Thanks for your help.

4 Aug 2010, 4:22 PM
#1538
hem avatar

hem

Totally Zenned

Join Date:
Sep 2007
Location:
Dublin, Ireland
Posts:
1,281
Plugin Contributions:
5

Re: Reward Points Module for ZC v13x

lauriesscraps:

I tried looking for these files and I am not seeing them. Even did a file search for them. Where would they be located? Sorry to bother again. Thanks for your help.

Most likely where your browser downloads files to and then possibly inside a zip file if that is what your backup program created.

4 Aug 2010, 4:31 PM
#1539
lauriesscraps avatar

lauriesscraps

Zen Follower

Join Date:
Sep 2009
Posts:
255
Plugin Contributions:
0

Re: Reward Points Module for ZC v13x

I used Core FTP to transfer the files from the server to my external hard drive so the files look the same as they do on the server. They didn't download to a temp folder like my other internet downloads do. I am sorry to be so difficult. I know this is simple, I guess I just need to get the same page as everyone else.

5 Aug 2010, 8:55 AM
#1540
darrenq avatar

darrenq

New Zenner

Join Date:
Apr 2010
Posts:
78
Plugin Contributions:
0

Re: Reward Points Module for ZC v13x

damiantaylor:

try

echo PRODUCT_REWARD_POINT_TAG . ' ' . $reward_points . ' ' . PRODUCT_REWARD_POINT_TAG_1;


Great thank you that sorted it. :clap: