Jump to content

How to get values of custom fields in gateway modules


Recommended Posts

Hello how do I get the customfields values in gateway modules? Can I get the value of customFields by name? I did a lot of tries, but I didn't figured out...  In Gateway config module I should set the ID of each customfield.

Exemplo:

  • ID Cutomer Field: 2 | Name: CPF
  • ID Cutomer Field: 15 | Name: WhatsApp
  • ID Cutomer Field: 19 | Name: moipCC
print_r($params["clientdetails"]["customfields"]);

Array ( 
    [0] => Array ( 
        [id] => 2 
        [value] => 222745448840 ) 
    [1] => Array ( 
        [id] => 15 
        [value] => 16994513223 ) 
    [2] => Array ( 
        [id] => 19 
        [value] => ) 

How do I get the value of ID Customer Field 15 without know the Array key.

Thanks

 

 

Link to comment
Share on other sites

I fixed it with whmcs help, thanks guys.... the solution was:

$myclientcustomfields = array();
foreach($params["clientdetails"]["customfields"] as $key => $value){
$myclientcustomfields[$value['id']] = $value['value'];
}

$mycustomFieldValue =   $myclientcustomfields[$params['customFieldSaved']];

I really don know why the whmcs api docs say one thing and in the real world, another thing happen... but the solution to get the customfields values was this for me....

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.

×
×
  • 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