NATS3 Geo-Target Join Options

From TMM Wiki
Jump to navigationJump to search
NATS 3
Skins & Templates Admin
Smarty Plugins
Skins
Editing Skins
Creating Skins
Switching Skins
Templates
nats_code
Affiliate Stats Template
Affiliate Support Template
Affiliate Login Template
custom errors.php
Template Array Variable
Detailed Stats
NATS Variables
Dialer Statistics
Affiliate Signup
Post URL Variables
Member Usernames & Passwords
Output An Affiliate's Last Paid Date
Custom Program and Campaign Selection Pages
CAPTCHA Removal
Username Recommendations
Password Retrieval
Post-Biller Templates
Geo-Target Join Options
Template Caching
Random Usernames and Passwords
Base Templates
Protecting Template Data
Mail Reseller Signup Template Variable Names
Smarty
Smarty print array
News Section Templating
Affiliate Signup Email
Getting The NATSCode
Checking for Usernames on All Sites
Adding Stats to Affiliate Pages
Affiliate Join Page Linkcodes

NOTE: This article is for NATS 3. NATS 4 does not require any template changes for Geo-Targeting; it is done using show/hide rules

You can localize your pre-join form to a surfer's country. One form can offer different join options to surfers from different countries.

Multiple Currency Setup

NATS records all transactions in its base currency. The base currency, which is usually U.S. Dollars (USD), is set at installation and cannot be changed. Although NATS records transactions in its base currency, you can create join options, at your billers, in other currencies -- but first you must tell NATS what exchange rate to use.

Go to the Configuration Admin, find the Currency Rates section and enter the current exchange rate between your base currency and all currencies you plan to use. You need to update this currency table whenever currency rates change.

Join Options

Go to the Sites Admin and edit the site to localize. Create the join options you want to offer. After saving each join option, record its ID number.

Join Template

Still in the Sites Admin, still editing the site to localize, click the Templates tab near the top of the screen. Edit the "join" template and find the following line of Smarty code:

{html_options options=$join_options selected=$vars.optionid}

This code displays all of the site's join options on the site's join form. To localize the join form, we must change the code to deal with each option individually. Replace the line above with the lines below.

{foreach from=$join_options item=join_item key=join_option_number}
	<option value="{$join_option_number}" {if $vars.optionid == $join_option_number}selected=selected{/if}>{$join_item}</option>
{/foreach}

The new code produces the same form as the old code, but it lets us work with each $join_option individually. For each join option, we put the join option's description in the Smarty variable, $join_item, and the join option's ID number in the Smarty variable, $join_option_number. We'll use both variables in just a moment.

NATS, configured with geo-targeting, stores the surfer's origin country abbreviation in the Smarty variable, $geoip_country. Country abbreviation are two-letters; for example: US for United States, DE for Germany, and NL for Netherlands. (See the Notes section below for the complete list of country abbreviations.)

The following code checks $geoip_country for a particular country abbreviation, "DE"; if it matches, the code checks for a particular join option number, "91"; if that matches too, join option 91 is shown. If either the DE or 91 don't match, the code checks for DE and 91 again; if either match, join option 91 isn't shown, but all other join options are shown.

{if ($geoip_country == 'DE') && ($join_option_number == '91')}
        <option value="{$join_option_number}" {if $vars.optionid == $join_option_number}selected=selected{/if}>{$join_item}</option>
{elseif ($geoip_country != 'DE') && ($join_option_number != '91')}
        <option value="{$join_option_number}" {if $vars.optionid == $join_option_number}selected=selected{/if}>{$join_item}</option>
{/if}

For example: if you have three join options -- join option numbers 90, 91, and 92 -- the code above shows join options 90 and 92 to surfers non-German surfers and join option 91 to German surfers.

In the above code, replace "DE" and "91" with the country abbreviation and join option number, go to the code you replaced earlier, and replace the line starting with "<option" with your customized code.

Checking for Two or More Countries or Join Options

To check for more than two country abbreviations or join option numbers, add checks to your if statements.

{if (($geoip_country == 'DE') || ($geoip_country == 'NL')) && (($join_option_number == '91') || ($join_option_number == '92'))}
        <option value="{$join_option_number}" {if $vars.optionid == $join_option_number}selected=selected{/if}>{$join_item}</option>
{elseif (($geoip_country != 'DE') && ($geoip_country != 'NL')) && (($join_option_number != '91') && ($join_option_number != '92'))}
        <option value="{$join_option_number}" {if $vars.optionid == $join_option_number}selected=selected{/if}>{$join_item}</option>
{/if}

For the same three join options used in the previous example -- join option numbers 90, 91, and 92 -- the code above shows join option 90 to surfers outside Germany or the Netherlands and join options 91 and 92 to surfers inside Germany or the Netherlands.

You can check for as many additional country abbreviations or join option numbers by adding a logical-or statement and a conditional to both {if} statements. (A logical-or is the "||" and a conditional is the statement between parenthesis.)

Cascades

On the surfer pre-join form, the Payment Type box lists this site's cascades. Our Geo-Targeting Cascades article explains how to localize cascades.

Notes

  • ISO 3166 Alpha 2 -- The International Standards Organization's list of country abbreviations