Difference between revisions of "Additional Domain Fields"
(→How do I customise the fields that are displayed?) |
|||
Line 62: | Line 62: | ||
"Remove" => true, | "Remove" => true, | ||
); | ); | ||
+ | </source> | ||
+ | |||
+ | '''Translating a Field Name'''<br/> | ||
+ | The field name can be translated via [[Language_Overrides|language override files]]. This allow you to change the label displayed on the shopping cart next to the additional domain field based upon the language in which the visitor is viewing your site. | ||
+ | # Define the field within your custom ''/resources/domains/additionalfields.php'' file and set the '''LangVar''' attribute to the desired language variable | ||
+ | # Add the translation string with the corresponding attribute to your language override file | ||
+ | |||
+ | <source lang="php"> | ||
+ | $additionaldomainfields[".co.uk"][] = array( | ||
+ | "Name" => "Legal Type", | ||
+ | "Options" => "Individual,UK Limited Company,UK Public Limited Company", | ||
+ | "LangVar" => "uktldlegaltype", | ||
+ | ); | ||
+ | </source> | ||
+ | |||
+ | Language override file entry: | ||
+ | |||
+ | <source lang="php"> | ||
+ | $_LANG['uktldlegaltype'] = "Custom Field Label Text"; | ||
</source> | </source> | ||
Revision as of 08:20, 31 August 2017
Contents
What are additional domain fields?
Additional domain fields (also commonly referred to as Extended Attributes) define the information required by domain registries for a given TLD.
When a domain registry requires the information, a domain name will fail to register successfully unless the values are provided.
Typical information requested by domain registries include things such as Registrant Legal Type, Registered Entity Name, etc...
When are the fields asked for?
Domain fields are displayed as part of the order process.
In the shopping cart they will appear during the Domains Configuration step.
If a field is required, customers will be required to provide the requested information before moving to the next step.
The values provided to these fields are then saved and submitted to the domain registrar when the domain is registered.
How do I customise the fields that are displayed?
The default field definitions that we ship with WHMCS can be found in /resources/domains/dist.additionalfields.php This file should not be edited.
To customise the fields, create a new file named additionalfields.php within the /resources/domains/ directory.
Adding a New Field
- Add a new entry into your custom /resources/domains/additionalfields.php file
- You can use the field formatting as found in the /resources/domains/dist.additionalfields.php file as a reference
$additionaldomainfields[".co.uk"][] = array(
"Name" => "Date of Birth",
"Type" => "text",
"Size" => "30",
);
Editing an Existing Field
- Begin by copying and pasting the field definition from the /resources/domains/dist.additionalfields.php file into your custom /resources/domains/additionalfields.php file
- Remove any key/value pairs for parameters you do not wish to customise
- Customise the remaining options as desired (in the example below the option values are being customised to just the 3 most commonly used options)
$additionaldomainfields[".co.uk"][] = array(
"Name" => "Legal Type",
"Options" => "Individual,UK Limited Company,UK Public Limited Company",
);
Removing an Existing Field
- Define the field within your custom /resources/domains/additionalfields.php file and set the Remove attribute to TRUE
$additionaldomainfields[".co.uk"][] = array(
"Name" => "Company ID Number",
"Remove" => true,
);
Translating a Field Name
The field name can be translated via language override files. This allow you to change the label displayed on the shopping cart next to the additional domain field based upon the language in which the visitor is viewing your site.
- Define the field within your custom /resources/domains/additionalfields.php file and set the LangVar attribute to the desired language variable
- Add the translation string with the corresponding attribute to your language override file
$additionaldomainfields[".co.uk"][] = array(
"Name" => "Legal Type",
"Options" => "Individual,UK Limited Company,UK Public Limited Company",
"LangVar" => "uktldlegaltype",
);
Language override file entry:
$_LANG['uktldlegaltype'] = "Custom Field Label Text";
Prepopulated Data Variables
The following variables are available for use with dropdown field types.
Tag | Description |
{Countries} | Provides a comma separated list of countries. A full country name will be saved and passed to the registrar for the field (eg. United Kingdom). |
{CountryCodeMap} | Provides an associative key value pair list of country codes and country names. This will display the full country name for a user to select from but only store and pass the ISO country code to the registrar (eg. GB). |
Example Usage
$additionaldomainfields[".co.uk"][] = array(
"Name" => "Registered Country",
"Type" => "dropdown",
"Options" => "{Countries}",
);