Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Referral Point System


Recommended Posts

I just started experimenting with this contribution and it seems to award the referral point immediately upon completion of the payment process.

 

I have a question too.

 

Currently it displays the prompt for entering a referral code (to generate a referral point for another customer) to customer's every time they shop.

 

In my situation, I would only want it to generate a referral point when a new customer makes their first purchase, while entering the referral code of an existing customer. Can anyone suggest a way to only show the referral code prompt to first time customers only?

Rule #1: Without exception, backup your database and files before making any changes to your files or database.

Rule #2: Make sure there are no exceptions to Rule #1.

Link to comment
Share on other sites

OK, I figured out the solution to my own question. Here it is in case anyone else wants to know:

 

In the BODY section of checkout_shipping.php and checkout_payment.php change:

 

<?php if(REFERRAL_ACCEPT_METHOD == 'checkout') { ?>

 

to:

 

<?php if(REFERRAL_ACCEPT_METHOD == 'checkout' && (tep_count_customer_orders() == 0)) { ?>

 

That's all it takes :)

Rule #1: Without exception, backup your database and files before making any changes to your files or database.

Rule #2: Make sure there are no exceptions to Rule #1.

Link to comment
Share on other sites

One further note.

 

I realize that you can choose to accept the referral during "Account Creation" rather than at "Checkout". However, in that case, the referral point is awarded at the completion of account creation rather than completion of the payment process.

Rule #1: Without exception, backup your database and files before making any changes to your files or database.

Rule #2: Make sure there are no exceptions to Rule #1.

Link to comment
Share on other sites

Hi Mike... Since you're experimenting with this contribution, maybe you can help answer my question..

 

How exactly does this module work? How do you set up the value for points (i.e - 1 point for every $ of a sale (excluding S&H & sales tax)?

 

Does this work like an affiliate program where people must sign up and be issued a referral code/unique id or is this something they can sign up for in their member account?

 

Right now I have the tell-a-friend module working on my site and I was thinking of adding this new module as a way to reward people for making referrals that turn into sales and hopefully encourage more people to make referrals. I am looking for a way to reward people with points to be used in my store for future purchases.. Will this module work that way?

 

Thanks.

Link to comment
Share on other sites

So far it looks like it is going to work for me. And it sounds like your interest is quite similar to mine.

 

In evaluating it, these are my observations about how it works:

 

In the Admin configuration menu it sets up a category called "Referral Options". In that section you can set several options including the redemption dollar value of each point.

 

Each reported referral credits the referer's account with 1 referral point, irregardless of the dollar value of the purchase.

 

In the options menu, you can select what form of referral code to use (auto generated code, user selected code, account email address) and its minimum length. Here is what I have observed testing these features:

  • Auto Generate - Fully functional as is. The system generates the code. However, to learn what it is, the persion must log into their account and scroll down to the Referral section. Not bad, but also might be missed by some customers, resulting in lack of use or support calls.
  • User Selected - Functional as is. Customer setting up account enters their choice. This is the method I am going to use, but I will modify the language file to be more explanatory about requirements for code.
  • Account email address - I couldn't get it to funcion on mine. The account setup properly assigns the email as the referral code. But it is rejected when you enter it as a referral code. Also, if you try to enter an email address as the referral code for an existing account in the admin/Customers menu, it refuses to accept non-alphanumeric characters such as @.

Also as I mentioned in the previous post, in the configuration menu you can also set the point at which the referral is taken - account creation or checkout.

 

In summary, I like it and plan to use it. I would like to see a fix to the bug in the account email referral code option as this would be my method of choice.

Rule #1: Without exception, backup your database and files before making any changes to your files or database.

Rule #2: Make sure there are no exceptions to Rule #1.

Link to comment
Share on other sites

  • 1 month later...

Has anybody made any modifications to get this to award more than 1 pt per transaction??

 

I want to install a module like this so that I can have points given to customers based on what the people they refer purchase, ie if the referred customer purchases a $200 item the points awarded to the referrer is more than if it was $50.

 

I also want to change where the point(s) are rewarded to after an order has had payment confirmed. So a temporary holding area for points would be my suggestion, as a status of pending.

 

If anybody has made any changes to the module please let us know...

 

Thanks,

 

VB

Link to comment
Share on other sites

I'm interested in this module as well, and glad to learn that is working (for the most part). Is there any way to integrate this module with the reward points module so that the points can be accumulated together?

 

Thanks

 

Rene

Link to comment
Share on other sites

  • 4 weeks later...
I'm interested in this module as well, and glad to learn that is working (for the most part). Is there any way to integrate this module with the reward points module so that the points can be accumulated together?

 

Thanks

 

Rene

yeaa..it'll be wonderful if this can be done! :D

Link to comment
Share on other sites

I am very interested in the Referral contribution but has anyone written instructions for just adding or replacing code. It seems it wants me to overwrite some of the files which I have allready modified for other things. Can anyone help with this.

THANKS

Helen

Link to comment
Share on other sites

  • 2 weeks later...

Hi,

 

This worked for me in order to make the email work as referral id.

 

1. Making the database field customers > customers_referral_id longer.

I.e making it varchar(50) instead of varchar(8)

 

This can be done in phpMyAdmin

 

2. Change some code in catalog/includes/functions/referrals.php and catalog/admin/includes/functions/referrals.php

 

Replace

 

  if($referral_id[$x] < '0' || $referral_id[$x] > 'z')
	 return(0);
 if($referral_id[$x] > '9' && $referral_id[$x] < 'A')
	 return(0);
 if($referral_id[$x] > 'Z' && $referral_id[$x] < 'a')
	 return(0);

 

With

  if($referral_id[$x] < '-' || $referral_id[$x] > 'z')
	 return(0);
 if($referral_id[$x] > '9' && $referral_id[$x] < '@')
	 return(0);
 if($referral_id[$x] > 'Z' && $referral_id[$x] < 'a')
	 return(0);

 

Perhaps someone can add this as a bugfix?

Link to comment
Share on other sites

  • 3 weeks later...

encountered following problems, any help ?

 

1. i have 10 point, if i enter 9.5 to redeem, i save 9.5 dollars,but my point is 0 left..

 

2. After enabled order total module of referral system, i can see the -9.5 $ should be deducted from my total, but in deed it does not..

 

3.if a customer too lazy or no need , then he may leave the referral input field blank.. but seems this is not accepted

 

thanks for looking into it

Link to comment
Share on other sites

  • 1 month later...

renesam,

 

Yes, it's working fine for me. Just had to do a little tweaking to fix the e-mail as referral id.

Also had to do some changes in order to give a percentage discount for each referral instead of a fixed amount.

Link to comment
Share on other sites

  • 1 month later...

I have the same issue. I'd love to integrate it but have so many changes that it's almost not worth it. Any ideas?

Thanks

Rebecca

 

I am very interested in the Referral contribution but has anyone written instructions for just adding or replacing code.  It seems it wants me to overwrite some of the files which I have allready modified for other things.  Can anyone help with this.

THANKS

Helen

Link to comment
Share on other sites

  • 4 months later...
I'm having a problem with the referral point system when you checkout it dosn't subtract the amount.

 

order total module  is enabled

 

I figured out why it wasn't showing up on the order confirmation page. I had the "sort_order" for my referral points redemtion module set the same as the shipping module so when I went to order confirmation the shipping module would overide the referral points

Link to comment
Share on other sites

  • 3 weeks later...
  • 5 months later...
  • 7 months later...
renesam,

 

Yes, it's working fine for me. Just had to do a little tweaking to fix the e-mail as referral id.

Also had to do some changes in order to give a percentage discount for each referral instead of a fixed amount.

 

I currently have the contribution installed on a test server, I have tried and everything works fine (great contribution), the only problem I have, and looks like you may have an answer for it, is that; I want the referrer to receive a X% from any sale generated, in which the referrer code was used instead of giving a flat amount.

Please let me know if you can help with this?As I'm currently working on the step by step installation for heavy modify shops, and I would like to add the % fix to it if possible.

Link to comment
Share on other sites

The modificatoins I did was for being able to give a percentage discount value per referral point.

For for every referral the referrer recieves 1 referral point.

At the checkout the referrer chooses how many referral points to spend and in this store he recieves 5% discount per referral point.

 

Example:

The user has 3 referral points which he wishes to spend. That gives 15% discount.

There is also a maximum number of referral points you are allowed to spend at one time, and a maximum order amount so the discount doesn't get to big.

 

pair, perhaps this is not what you are looking for, but maybe this can put you in the right direction.

 

I did theese modificatisons over a year ago, and since that my computer was stolen, so I lost all my documentation. Therefore there is absolutely NO GUARANTEE that this is going to work.

Back up files before before modifying, and don't complain to me if it breaks anything.

I have taken snippets of the code from the live store, and i think I have included it all, but there is no guarantee for that either.

Feel free to use it as you like, or include it in the contribution.

 

 

SQL statements

insert into configuration (configuration_id, configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, last_modified, date_added, use_function, set_function) values ('224', 'Percentage discount per referral point', 'REFERRAL_PERCENT_VALUE', '5.00', ' Percentage discount per referral.', '113', '55', NULL, '0000-00-00 00:00:00', NULL, NULL);

insert into configuration (configuration_id, configuration_title, configuration_key, configuration_value, configuration_description, configura
tion_group_id, sort_order, last_modified, date_added, use_function, set_function) values ('225', 'Maximum order amount with referral discount', 'REFERRAL_MAX_PURCHASE', '2000', 'Maximum order amount for which you are allowed to use referral discount.', '113', '56', NULL, '0000-00-00 00:
00:00', NULL, NULL);

 

 

/includes/classes/order.php

//	  if(USE_REFERRAL_SYSTEM == 'true') {
//		$referral_discount = (float)tep_calc_referral_pvalue($customer_referral_points_spending);
//	  }

  if(USE_REFERRAL_SYSTEM == 'true') {
	$referral_discount = ((float)REFERRAL_PERCENT_VALUE / 100) * $this->info['subtotal'] * $customer_referral_points_spending;
  }

 

/includes/functions/referrals.php

function tep_calc_referral_pvalue($points)
{
global $order;
//	  return((float)$points * (float)REFERRAL_POINT_VALUE);
	return((float)$points * (REFERRAL_PERCENT_VALUE / 100) * $order->info['subtotal']);
}

 

/includes/modules/order_total/ot_referrals.php

//		$this->output[] = array('title' => 'Referral Points Redeemed (' . $customer_referral_points_spending . ' x ' .$currencies->format(REFERRAL_POINT_VALUE, true, $order->info['currency'], $order->info['currency_value']) . '):',
	$this->output[] = array('title' => 'Referral Points Redeemed (' . $customer_referral_points_spending . ' x ' . tep_display_tax_value(REFERRAL_PERCENT_VALUE,0) . '%):',

 

I use templates, for a normal store you should modify checkout_payment.php

/templates/Standard/content/checkout_payment.tpl.php

<?php if(REFERRAL_ACCEPT_METHOD == 'checkout' && (tep_count_customer_orders() == 0)) { ?>
			<tr>
			  <td class="main"><?php echo TEXT_REFERRAL_REFERRED; ?></td>
			</tr>
			<tr>
			  <td class="main"><?php echo tep_draw_input_field('customer_referral_referred', $customer_referral_referred); ?></td>
			</tr>
<?php }
  if($customer_referral_points > 0) { ?>
			<tr>
			  <td class="main"><?php
//RW 20050126
echo TEXT_REFERRAL_POINTS_START . $customer_referral_points . TEXT_REFERRAL_POINTS_MIDDLE . tep_display_tax_value(REFERRAL_PERCENT_VALUE,0) . ' % discount. <br>You are not allowed to use more than 20 points at the same time, and the total order amount can not be over ' . REFERRAL_MAX_PURCHASE . ' $.<br> The amount in the cart is now: ' . $cart->show_total(). ' $'; ?></td>
			</tr>
<?php if ($cart->show_total() < REFERRAL_MAX_PURCHASE ){
?>
			<tr>
			  <td class="main"><?php echo TEXT_REFERRAL_SPENDING . tep_draw_input_field('customer_referral_points_spending', $customer_referral_points_spending); ?></td>
			</tr>
<?php
}
}
?>

 

I use templates, for a normal store you should modify checkout_shipping.php

/templates/Standard/content/checkout_shipping.tpl.php

<?php if(REFERRAL_ACCEPT_METHOD == 'checkout' && (tep_count_customer_orders() == 0)) { ?>
			<tr>
			  <td class="main"><?php echo TEXT_REFERRAL_REFERRED; ?></td>
			</tr>
			<tr>
			  <td class="main"><?php echo tep_draw_input_field('customer_referral_referred', $customer_referral_referred); ?></td>
			</tr>
<?php }
  if($customer_referral_points > 0) { ?>
			<tr>
			  <td class="main">
<?php
//RW 20050126
echo TEXT_REFERRAL_POINTS_START . $customer_referral_points . TEXT_REFERRAL_POINTS_MIDDLE . tep_display_tax_value(REFERRAL_PERCENT_VALUE,0) . ' % rabatt. <br> You are not allowed to use more than 20 points at the same time, and the total order amount can not be over ' . REFERRAL_MAX_PURCHASE . ' $.<br>  The amount in the cart is now: ' . $cart->show_total(). ' $'; ?></td>
			</tr>
<?php if ($cart->show_total() < REFERRAL_MAX_PURCHASE ){
?>
			<tr>
			  <td class="main"><?php echo TEXT_REFERRAL_SPENDING . tep_draw_input_field('customer_referral_points_spending', $customer_referral_points_spending); ?></td>
			</tr>
<?php
}
}
?>

Link to comment
Share on other sites

I need a referral system that works like the HTTP_REFERER contrib, where the system will tell you the referral url, but instead of coming from a website the customer will be coming from an email with a link to the shopping cart.

 

Did that make sense? I hope so :lol:

 

Anyway, from Dilder's post I kind of get the impression that this contribution will do what i need. Am I correct, or am I way off?

Link to comment
Share on other sites

The modificatoins I did was for being able to give a percentage discount value per referral point.

For for every referral the referrer recieves 1 referral point.

At the checkout the referrer chooses how many referral points to spend and in this store he recieves 5% discount per referral point.

 

Example:

The user has 3 referral points which he wishes to spend. That gives 15% discount.

There is also a maximum number of referral points you are allowed to spend at one time, and a maximum order amount so the discount doesn't get to big.

 

pair, perhaps this is not what you are looking for, but maybe this can put you in the right direction.

 

I did theese modificatisons over a year ago, and since that my computer was stolen, so I lost all my documentation. Therefore there is absolutely NO GUARANTEE that this is going to work.

Back up files before before modifying, and don't complain to me if it breaks anything.

I have taken snippets of the code from the live store, and i think I have included it all, but there is no guarantee for that either.

Feel free to use it as you like, or include it in the contribution.

SQL statements

insert into configuration (configuration_id, configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, last_modified, date_added, use_function, set_function) values ('224', 'Percentage discount per referral point', 'REFERRAL_PERCENT_VALUE', '5.00', ' Percentage discount per referral.', '113', '55', NULL, '0000-00-00 00:00:00', NULL, NULL);

insert into configuration (configuration_id, configuration_title, configuration_key, configuration_value, configuration_description, configura
tion_group_id, sort_order, last_modified, date_added, use_function, set_function) values ('225', 'Maximum order amount with referral discount', 'REFERRAL_MAX_PURCHASE', '2000', 'Maximum order amount for which you are allowed to use referral discount.', '113', '56', NULL, '0000-00-00 00:
00:00', NULL, NULL);

/includes/classes/order.php

//	  if(USE_REFERRAL_SYSTEM == 'true') {
//		$referral_discount = (float)tep_calc_referral_pvalue($customer_referral_points_spending);
//	  }

  if(USE_REFERRAL_SYSTEM == 'true') {
	$referral_discount = ((float)REFERRAL_PERCENT_VALUE / 100) * $this->info['subtotal'] * $customer_referral_points_spending;
  }

 

/includes/functions/referrals.php

function tep_calc_referral_pvalue($points)
{
global $order;
//	  return((float)$points * (float)REFERRAL_POINT_VALUE);
	return((float)$points * (REFERRAL_PERCENT_VALUE / 100) * $order->info['subtotal']);
}

 

/includes/modules/order_total/ot_referrals.php

//		$this->output[] = array('title' => 'Referral Points Redeemed (' . $customer_referral_points_spending . ' x ' .$currencies->format(REFERRAL_POINT_VALUE, true, $order->info['currency'], $order->info['currency_value']) . '):',
	$this->output[] = array('title' => 'Referral Points Redeemed (' . $customer_referral_points_spending . ' x ' . tep_display_tax_value(REFERRAL_PERCENT_VALUE,0) . '%):',

 

I use templates, for a normal store you should modify checkout_payment.php

/templates/Standard/content/checkout_payment.tpl.php

<?php if(REFERRAL_ACCEPT_METHOD == 'checkout' && (tep_count_customer_orders() == 0)) { ?>
			<tr>
			  <td class="main"><?php echo TEXT_REFERRAL_REFERRED; ?></td>
			</tr>
			<tr>
			  <td class="main"><?php echo tep_draw_input_field('customer_referral_referred', $customer_referral_referred); ?></td>
			</tr>
<?php }
  if($customer_referral_points > 0) { ?>
			<tr>
			  <td class="main"><?php
//RW 20050126
echo TEXT_REFERRAL_POINTS_START . $customer_referral_points . TEXT_REFERRAL_POINTS_MIDDLE . tep_display_tax_value(REFERRAL_PERCENT_VALUE,0) . ' % discount. <br>You are not allowed to use more than 20 points at the same time, and the total order amount can not be over ' . REFERRAL_MAX_PURCHASE . ' $.<br> The amount in the cart is now: ' . $cart->show_total(). ' $'; ?></td>
			</tr>
<?php if ($cart->show_total() < REFERRAL_MAX_PURCHASE ){
?>
			<tr>
			  <td class="main"><?php echo TEXT_REFERRAL_SPENDING . tep_draw_input_field('customer_referral_points_spending', $customer_referral_points_spending); ?></td>
			</tr>
<?php
}
}
?>

 

I use templates, for a normal store you should modify checkout_shipping.php

/templates/Standard/content/checkout_shipping.tpl.php

<?php if(REFERRAL_ACCEPT_METHOD == 'checkout' && (tep_count_customer_orders() == 0)) { ?>
			<tr>
			  <td class="main"><?php echo TEXT_REFERRAL_REFERRED; ?></td>
			</tr>
			<tr>
			  <td class="main"><?php echo tep_draw_input_field('customer_referral_referred', $customer_referral_referred); ?></td>
			</tr>
<?php }
  if($customer_referral_points > 0) { ?>
			<tr>
			  <td class="main">
<?php
//RW 20050126
echo TEXT_REFERRAL_POINTS_START . $customer_referral_points . TEXT_REFERRAL_POINTS_MIDDLE . tep_display_tax_value(REFERRAL_PERCENT_VALUE,0) . ' % rabatt. <br> You are not allowed to use more than 20 points at the same time, and the total order amount can not be over ' . REFERRAL_MAX_PURCHASE . ' $.<br>  The amount in the cart is now: ' . $cart->show_total(). ' $'; ?></td>
			</tr>
<?php if ($cart->show_total() < REFERRAL_MAX_PURCHASE ){
?>
			<tr>
			  <td class="main"><?php echo TEXT_REFERRAL_SPENDING . tep_draw_input_field('customer_referral_points_spending', $customer_referral_points_spending); ?></td>
			</tr>
<?php
}
}
?>

Hey Dilder,

Thank you for the information I'm sure that someone will use it.

However as you stated before this is not what I was looking for, I need a contribution that will give the referrer (person that gave out the coupon or code) 5% from the total sale (generated from the use of the referrers coupon) I hope it makes sense.

If you know of a contribution or code that will do this, please let me know, as I really need it.

If not is OK as I really appreciated your help anyway.

 

Thanks a lot.

Regards,

Cool.

Link to comment
Share on other sites

  • 1 year later...

I've hear of someone else that was looking for a percentage of the sale going to the referrer (I buy $75, the refer percentage is set to 10%, you get $7.50 in referral points.)

 

Personally, I've come across a great idea for this system, but I'm a little too new at PHP to implement it:

I want to have an item (Gift certificate?) the allows people to buy referral points.

So, You buy item A, B and two Gift Certs.

On gift Cert 1 you refer Me (thankie) and I get points 1-for-1 equal to the dollar amount you spend (or whatever the going rate is).

On gift Cert 2 you refer someone else, same thing.

At successful cash out the points are awarded, just like the main system.

 

 

Also, has anyone else noticed that customers who do not get referral codes when this is implemented get awarded points every time a refer is made? This happened to me, but forcing a code on everyone seemed to clear it up. the down side is that once the blank customers log in, they keep the phantom points. I nearly lost thousands.

Link to comment
Share on other sites

  • 4 months later...

Hello All,

 

This is a GREAT thread for a GREAT contribution. This contribution is a 95% match to what I need to implement for a referral system.

 

I do, however, have a few concerns that maybe someone has already addressed so I don't go and reinvent the wheel.

 

1. You are allowed to redeem more points than the total for your order (including tax & Shipping), making the total of the sale a credit. This could potentially be passed on the PayPal (and I am not sure how that would be handled after that)... But, potentially not good.

 

2. Like others, I find that the e-mail address is not being setup in the customers_referral_id when that method is selected. However, is researching before I found this thread, I also noticed that the function tep_is_referral_code_valid does not consider the method to use for the referral code. I see the post earlier, but am curious from those more familiar with this contribution about changing the function instead, which would not require a DB schema change to the contribution. Currently, I am leaning more toward changing tep_is_referral_code_valid.

 

3. I would like to limit how the point redemption can be applied. For example, I would like the point to only be available to be redeemed against the cost of the product, and not tax or shipping & handling.

 

4. Finally, does anyone have an example of the "Terms and Conditions" that they posted on their site that relate to the Referral Point System? I'm no lawyer, but I know enough to put out disclaimers in this sue-happy society. (oops, was that a gripe??)

 

 

Also, thank you GraphicsGuy for the contribution for first-time purchases. I very much will implement your solution.

 

 

Adam

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...