Difference between revisions of "Domain Categories"

From WHMCS Documentation

(Created page with "<div class="docs-alert-info"><i class="fa fa-info-circle"></i> This page describes a feature available in version 7.10 and above.</div> --whatever code is necessary here to a...")
 
 
(5 intermediate revisions by 3 users not shown)
Line 1: Line 1:
<div class="docs-alert-info"><i class="fa fa-info-circle"></i> This page describes a feature available in version 7.10 and above.</div>
+
<div class="docs-alert-info"><i class="fa fa-info-circle"></i>This page describes a feature available in version 7.10 and above.</div>
 
 
--whatever code is necessary here to add contents table--
 
  
 
==What are domain categories?==
 
==What are domain categories?==
  
Domain Categories are used in the client area to group domain TLDs into categories such as "Popular", "Shopping", or "Real Estate" and makes it easier for clients to navigate and find their ideal domain extension.
+
Domain categories are used in the Client Area to group domain TLDs into categories such as ''Popular'', ''Shopping'', or ''Real Estate''. They make it easier for clients to navigate and find their ideal domain extensions.
  
==How do I customise the domain categories?==
+
==How do I customise domain categories?==
  
The domain categories shipped with WHMCS by default can be found in ''/resources/domains/dist.categories.json''. This file should '''not''' be edited.
+
The domain categories that WHMCS ships with by default can be found in <tt>/resources/domains/dist.categories.json</tt>. Do '''not''' edit this file.
  
To add or edit domain category definitions, begin by creating a custom categories.json file located at ''/resources/domains/categories.json''
+
To add or edit domain category definitions, begin by creating a custom JSON file at <tt>/resources/domains/categories.json</tt>.  This file '''must only''' contain [https://www.json.org/json-en.html valid JSON]. In this file, define the domain categories you want to use. This file remains in place when you update WHMCS, ensuring that your customizations are not altered by the upgrade process.
  
Inside it, define the domain categories you wish to use. This file will remain in place when updating WHMCS.
+
TLDs can appear in multiple categories; for example, a UK-based company might include the <tt>.uk</tt> and <tt>.co.uk</tt> TLDs in the ''Popular'' category as well as a ''Local Geographic'' category.
  
TLDs can appear in multiple categories, for example, a UK-based company might include .UK and .CO.UK TLDs in the "Popular" category as well as a "Local Geographic" category.
+
===Adding a TLD or Category===
 +
 +
In your custom <tt>/resources/domains/categories.json</tt> file, add a section that resembles this example:
 +
 +
<source lang="yaml">
 +
{
 +
  "Domains A-F": [
 +
    ".biz",
 +
    ".ca",
 +
    ".com",
 +
    ".co.uk",
 +
    ".de",
 +
    ".eu"
 +
  ]
 +
}
 +
</source>
  
Below is a sample custom categories.json file defining the domain category "Awesome Domains" with the ".whmcs" and ".whmcstest" domain TLDs.
+
This example adds a domain category called "Domains A-F" with several TLDs.
  
===Sample whois.json Override File===
+
A domain category definition is simply the category name, with an array of the domain TLDs which should be included in that category.
 +
 
 +
===Removing a TLD from a default TLD Category===
 +
 +
Inside your custom <tt>/resources/domains/categories.json</tt> file, add a section that resembles this example:
 +
 
<source lang="yaml">
 
<source lang="yaml">
 +
{
 +
  "REMOVE": {
 +
    "Popular": [
 +
      ".com",
 +
      ".net"
 +
    ]
 +
  }
 +
}
 +
</source>
  
 +
This example removes the <tt>.com</tt> and <tt>.net</tt> TLDs from showing in the default ''Popular'' category.
 +
 +
===Additions and Removals===
 +
 +
If you want to both create and add to new categories while removing TLDs from default categories, you will need to place both the additions and removals in the same set of curly braces. For example:
 +
 +
<source lang="yaml">
 
{
 
{
"Awesome Domains": [
+
  "Domains A-F": [
".whmcs",
+
    ".biz",
".whmcstest"
+
    ".ca",
]
+
    ".com",
 +
    ".co.uk",
 +
    ".de",
 +
    ".eu"
 +
  ],
 +
  "REMOVE": {
 +
    "Popular": [
 +
      ".com",
 +
      ".net"
 +
    ]
 +
  }
 
}
 
}
 +
</source>
  
 +
===Category Dynamic Translations===
 +
 +
To set a Client Area category name that matches the visitor's chosen language, see our [https://developers.whmcs.com/languages/overrides/ Language Overrides Developer Documentation].
 +
 +
Using the below example, you can add an override string to each language file:
 +
 +
<source lang="yaml">
 +
$_LANG['domainTldCategory']['Money and Finance'] = "Geld und Finanzen";
 
</source>
 
</source>
 
+
A domain category definition is simply the category name, with an array of the domain TLDs which should be included in that category.
+
Adding this example to the <tt>german.php</tt> language override file translates the <tt>Money and Finance</tt> category name into the German language.

Latest revision as of 14:44, 13 November 2023

This page describes a feature available in version 7.10 and above.

What are domain categories?

Domain categories are used in the Client Area to group domain TLDs into categories such as Popular, Shopping, or Real Estate. They make it easier for clients to navigate and find their ideal domain extensions.

How do I customise domain categories?

The domain categories that WHMCS ships with by default can be found in /resources/domains/dist.categories.json. Do not edit this file.

To add or edit domain category definitions, begin by creating a custom JSON file at /resources/domains/categories.json. This file must only contain valid JSON. In this file, define the domain categories you want to use. This file remains in place when you update WHMCS, ensuring that your customizations are not altered by the upgrade process.

TLDs can appear in multiple categories; for example, a UK-based company might include the .uk and .co.uk TLDs in the Popular category as well as a Local Geographic category.

Adding a TLD or Category

In your custom /resources/domains/categories.json file, add a section that resembles this example:

{
  "Domains A-F": [
    ".biz",
    ".ca",
    ".com",
    ".co.uk",
    ".de",
    ".eu"
  ]
}

This example adds a domain category called "Domains A-F" with several TLDs.

A domain category definition is simply the category name, with an array of the domain TLDs which should be included in that category.

Removing a TLD from a default TLD Category

Inside your custom /resources/domains/categories.json file, add a section that resembles this example:

{
  "REMOVE": {
    "Popular": [
      ".com",
      ".net"
    ]
  }
}

This example removes the .com and .net TLDs from showing in the default Popular category.

Additions and Removals

If you want to both create and add to new categories while removing TLDs from default categories, you will need to place both the additions and removals in the same set of curly braces. For example:

{
  "Domains A-F": [
    ".biz",
    ".ca",
    ".com",
    ".co.uk",
    ".de",
    ".eu"
  ],
  "REMOVE": {
    "Popular": [
      ".com",
      ".net"
    ]
  }
}

Category Dynamic Translations

To set a Client Area category name that matches the visitor's chosen language, see our Language Overrides Developer Documentation.

Using the below example, you can add an override string to each language file:

$_LANG['domainTldCategory']['Money and Finance'] = "Geld und Finanzen";

Adding this example to the german.php language override file translates the Money and Finance category name into the German language.