Difference between revisions of "Domain Categories"

From WHMCS Documentation

(How do I customise the domain categories?)
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>
  
 
==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 <tt>/resources/domains/dist.categories.json</tt>. 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 <tt>/resources/domains/categories.json</tt>.
+
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===
 
 
===Adding a TLD/Category===
 
 
   
 
   
Inside your custom <tt>/resources/domains/categories.json</tt> file, add a section that resembles this example:
+
In your custom <tt>/resources/domains/categories.json</tt> file, add a section that resembles this example:
 
   
 
   
 
<source lang="yaml">
 
<source lang="yaml">
 
 
{
 
{
    "Awesome Domains": [
+
  "Domains A-F": [
        ".whmcs",
+
    ".biz",
        ".whmcstest"
+
    ".ca",
     ]
+
    ".com",
 +
     ".co.uk",
 +
    ".de",
 +
    ".eu"
 +
  ]
 
}
 
}
 
 
</source>
 
</source>
  
This example adds a domain category called "Awesome Domains" with the ".whmcs" and ".whmcstest" domain TLDs.
+
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.
 
A domain category definition is simply the category name, with an array of the domain TLDs which should be included in that category.
Line 39: Line 39:
 
   
 
   
 
<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">
 
{
 
{
"REMOVE": {
+
  "Domains A-F": [
     "Popular" : [
+
    ".biz",
        ".com", ".net"
+
    ".ca",
 +
    ".com",
 +
    ".co.uk",
 +
    ".de",
 +
    ".eu"
 +
  ],
 +
  "REMOVE": {
 +
     "Popular": [
 +
      ".com",
 +
      ".net"
 
     ]
 
     ]
},
+
  }
 
+
}
 
</source>
 
</source>
 
This example removes the .com and .net TLD from showing in the default Popular category.
 

Revision as of 16:18, 28 June 2021

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"
    ]
  }
}