Jump to content

Custom categories.json file not working


Recommended Posts

Hi

I created a categories.json file as outlined in this page: https://docs.whmcs.com/Domain_Categories

I followed the instructions, created the new categories.json file.  Modified the file and saved it - see file-manager.png

When I go to my domain page, the existing categories are still there and my new ones are not showing up at all. 

Also they mention in the article that The domain categories shipped with WHMCS by default can be found in /resources/domains/dist.categories.json. This file should not be edited.  This file does not exist in this folder (see image file-manager).

What I ideally want is not to show their default categories at all but to only show my categories.

I have also attache my categories.json file for review too.

 

 

 

 

file-manager.png

categories.json

Link to comment
Share on other sites

23 hours ago, Mojocreative said:

I followed the instructions, created the new categories.json file.  Modified the file and saved it - see file-manager.png

When I go to my domain page, the existing categories are still there and my new ones are not showing up at all. 

it didn't help that categories.json wasn't configured correctly...

{
"New Zealand Domains": [".co.nz",".nz",".net.nz",".org.nz",".ac.nz",".gen.nz",".geek.nz",".maori.nz",".school.nz",".kiwi.nz",".kiwi"],
"Australian Domains": [".com.au",".net.au",".org.au"],
"International Domains": [".com",".net",".org",".co",".info",".biz",".us",".co.za",".uk",".co.uk","eu",".fr",".it",".de"],
"Asia Domains": [".asia",".sg",".cn",".jp",".in",".ph",".my",".hk",".id"]
}

oBpyydZ.png

23 hours ago, Mojocreative said:

Also they mention in the article that The domain categories shipped with WHMCS by default can be found in /resources/domains/dist.categories.json. This file should not be edited.  This file does not exist in this folder (see image file-manager).

as the docs page says, that file only exists in v7.10 or later - going by those creation dates in the screenshot, it looks like it's a v7.9.2 or earlier version - and therefore the above documentation wouldn't apply.

if it's pre v7.10, then the categories will be defined in the database and not in the json files.

23 hours ago, Mojocreative said:

What I ideally want is not to show their default categories at all but to only show my categories.

even for a new feature, it's extraordinarily flaky and badly documented - i'm sure that I did that once, but could never repeat it.. nor remember exactly how... though I suspect it involved playing with the encoding of the file.

if you really had to, there are ways to do it with v7.10+ (see below image), but if you're using an earlier version, that method wouldn't be available to you - so you'd be left with editing the database, hooking or modifying the template.

U1tJPEQ.png

Link to comment
Share on other sites

Thank you for you help - I updated my categories.json as above and it is now working .  I have also upgraded to the latest version v7.10.

It is now displaying correctly.  I still have Popular and Geographic Categories popping up, will see how I can hide them

Link to comment
Share on other sites

  • 2 weeks later...

i wasnt even aware this was a thing till a couple of days ago...

I created a direct copy of the dist.categories.json file and added in the .com.au and .net.au and removed others on the popular section as:

  "Popular": [
    ".com",
    ".net",
    ".com.au",
    ".net.au",
    ".org",
    ".info",
    ".biz",
    ".me",
    ".mobi",
    ".online",
    ".site",
    ".blog",
    ".club",
    ".shop",
    ".hotel"
  ],

 

and saved the file and i find that the Popular list comes with a whole heap of tld's that are not even active or in the popular list. I have cleared my browser cache and the whmcs templates cache and still this happens...

i would have assumed it should only show the 15 Popular ones i have in the json file and not all the weird ones that were in the default file.
 

Capture.PNG

Link to comment
Share on other sites

2 hours ago, theozsnowman said:

i would have assumed it should only show the 15 Popular ones i have in the json file and not all the weird ones that were in the default file.

that's a valid assumption, but I think it's buggy in that you can add domains to the list, but seemingly not remove - e.g it loads dist. and then adds the custom json on top of those categories, rather than replacing.

that said, it shouldn't be showing TLDs that you haven't added pricing for, e.g .br, nl etc - if I use your categories.json file locally, it works fine and it's not showing the other 2 letter "weird" TLDs...

9UfsgbF.png

one temporary fix would be to modify dist.categories.json and replace its content with...

{}

that effectively removes all the category arrays and then it will only use the content of your custom categories.json to create the arrays - so they will be exactly as you want them... and any domains that aren't categorised by you, with be put in the "other" category.

now I know the docs say that you shouldn't edit dist.categories.json, but that's only because a WHMCS update will overwrite the file (or you might break the content!), but it's unlikely there is going to be another v7.10 minor release and it's going to be many months before v8 is in and out of beta.. by which time, this situation will hopefully be fixed or better documented.

p.s - why is it snowing ? ❄️

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated