Jump to content

How can I get the additional fields' names with WHMCS classes?


JavierCN

Recommended Posts

Hello:

I want to save orders via API, and I want to specify additional fields values of the domains in the order.

Do you know how can I manage the additional fields regarding to a TLD by using classes of WHMCS?

I mean like this:

// set contact for the domain
$contactId = 12345;

// get fields
$addFields = $addfields->domain("example.fr")->fields();

// assign contact to domain additional fields
$fieldsIntoOrder = [];
foreach ($addFields as $field) {
    if (in_array(strtolower($field), ["owner", "admin", "tech", "billing"]) {
         $fieldsIntoOrder[$field] = $contactId;
    }
}

$result = localAPI("AddOrder", [
    ...
    "customfields" => base64_encode(serialize($fieldsIntoOrder)),
    ...
];

Regards.

 

Edited by JavierCN
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