Other Example Coupon Code Systems

From TMM Wiki
Jump to navigationJump to search

PLEASE REFER TO THIS PAGE IF ABOVE 4.1.17.2 http://tmmwiki.com/index.php/NATS4_Coupon_Codes

Example Coupon Code Systems

Redirecting to a Special Join Form

One method you can use to offer a Coupon Code system in NATS is by redirecting surfers with a valid coupon code to a special join form containing a No Cost Registration join option.

With this method, you can add a new page for members to enter a Coupon Code on your join form. If no coupon code is entered, they will be taken to your default join form. However, if the member enters a valid coupon code, they will be taken to a special join form containing the No Cost Registration option, which allows the member to sign up without entering any payment information.

The following code provides an example of how you can set up a basic form to accept coupon codes:

Do you have a coupon?<br>
<form action="http://my.coupon.script.com/validate.php" method="get">
Coupon Code: 
<input type="text" name="coupon">
<input type="submit" value="Validate">
</form>

Replace my.coupon.script.com in the above example with the linkdomain you wish to use to validate your members' coupon codes.

Once you create this form, you can then set up a redirect script that brings your members to your No Cost Registration join form with a valid Coupon Code, or to a standard NATS join form if they enter an incorrect Coupon Code or leave the form blank.

Using Smarty to Display Special Join Options

Another example method you can use to offer Coupon Codes to your members involves using Smarty to display your special join option.

You can use this method in conjunction with the first method detailed above by using the special join form to validate a member's Coupon Code, then sending the member back to the join form with an additional URL parameter if they enter a valid code.

You can then use Smarty to display your No Cost Registration join option after verifying that the member was redirected through the URL parameter you set. If a member does not enter a valid Coupon Code, you can use Smarty to display your normal set of join options.

This can be done by inserting the following example code in your join template:

{if $smarty.get.coupon_valid = 1}
<select name="signup[optionid]" class="join_select">
  <option label="Free 3 days" value="xxxx" selected="selected">Free 3 days</option>
</select>
{else}
<select name="signup[optionid]" class="join_select">
  {html_options options=$join_options selected=$vars.optionid}
  </select>{if $errors.optionid}<span class="join_error"><br>{$errors.optionid}</span>{/if}
{/if}

In this example, only your No Cost Registration join option will be displayed if the URL parameter "coupon_valid" is present in the URL and equal to 1. If this is not the case, your normal join options will be displayed to the member. This code is based on the standard NATS join page, which uses a drop-down menu to display your join options.

Showing/Hiding Join Options Using JavaScript

Another method you can use to offer Coupon Codes to your members is by hiding your special join option using JavaScript code, which will reveal the join option once a member's coupon code is validated.

This method also allows you to add a special field for your members to add a coupon code. However, you only need one join form to use this method, as opposed to the first method. With this method, a member who does not have a valid coupon code will not see your No Cost Registration join option, because it will be hidden by JavaScript code. Only a member who enters a valid coupon code will be able to see that join option.