Jump to content

How to set customfields values on payment getaway configs?


Recommended Posts

Hello I'm trying to create a gateway payment integrate with whmcs credit card default system. In Gateway payment configs (admin/configgateways.php) I would like to set an option of each customfields with dropbox than input text.   

check the image: https://prnt.sc/jffxs1

I need to set it on method getwayname_config()

check the image: https://prnt.sc/jffyap

function GATEWAYNAME_config()
{
    return array(
        // the dropdown field type renders a select menu of options
        'dropdownField' => array(
            'FriendlyName' => 'Dropdown Field',
            'Type' => 'dropdown',//// HOW TO SHOW CUSTOMFIELDS INTO DROPDOWNFIELD?
            'Options' => $params["clientdetails"]["customfields"], 
            'Description' => 'Choose one',
        ));
}
               

 

How to populate the dropdown field on admin payment gateway config with customsfields names?

 

any help will great!!! thanks

 

 

 

 

 

 

Screenshot from 2018-05-08 17-00-31.png

Screenshot from 2018-05-08 16-58-38.png

Link to comment
Share on other sites

No one??

 

function GATEWAYNAME_config()
{
    return array(
        // the dropdown field type renders a select menu of options
        'dropdownField' => array(
            'FriendlyName' => 'Dropdown Field',
            'Type' => 'dropdown',//// HOW TO SHOW CUSTOMFIELDS INTO DROPDOWNFIELD?
            'Options' => $params["customfield"], 
            'Description' => 'Choose one',
        ));
}

 

HOW TO SHOW CUSTOMFIELDS INTO DROPDOWNFIELD?

I would like to show a dropdownfield in config of gateway, the custom customers fields is like birthday, brazilian document numbers etc.

I set it by number in a text box, is very hard, because is doubt.. I would like to bring it automatic with dropdown (select and option) at gateway config in admin.

is it clear? i hope so...


Thanks
 

Link to comment
Share on other sites

29 minutes ago, souzadavi said:

No one??

 


function GATEWAYNAME_config()
{
    return array(
        // the dropdown field type renders a select menu of options
        'dropdownField' => array(
            'FriendlyName' => 'Dropdown Field',
            'Type' => 'dropdown',//// HOW TO SHOW CUSTOMFIELDS INTO DROPDOWNFIELD?
            'Options' => $params["customfield"], 
            'Description' => 'Choose one',
        ));
}

 

HOW TO SHOW CUSTOMFIELDS INTO DROPDOWNFIELD?

I would like to show a dropdownfield in config of gateway, the custom customers fields is like birthday, brazilian document numbers etc.

I set it by number in a text box, is very hard, because is doubt.. I would like to bring it automatic with dropdown (select and option) at gateway config in admin.

is it clear? i hope so...


Thanks
 

Olá, Davi! como vai?

Pelo que entendi você quer listar os campos customizáveis nas configurações do módulo?

Veja o vídeo http://nimb.ws/4xwC5y e confira se é isso que necessita.

 

Link to comment
Share on other sites

I got it!! thanks for whmcs support team and programmers friends.... the solution was:

 

I created a function:

function get_customfield_id() {
    $fields = mysql_query("SELECT id, fieldname FROM tblcustomfields WHERE type = 'client';");
    if (!$fields) {
        return '<br><br>Erro geral no banco de dados';
    } elseif (mysql_num_rows($fields) >= 1) {

        $dropFieldArray = array();
 
        $tutorial = '<br><br>Para sua comodidade, listamos abaixo os campos que podem ser usados e seus IDs. Basta pegar o ID e preencher acima. <ul>';
        while ($field = mysql_fetch_assoc($fields)) {

        // the dropdown field type renders a select menu of options
        $dropFieldArray[$field['id']] = $field['fieldname'];


 
        }
       return $dropFieldArray;
    } else {
        return array('0' => 'nada definido');
    }
   
}

and into _config() method i just give a call to this function like this:

        'birthday' => array(
            'FriendlyName' => 'Birthday Date',
            'Type' => 'dropdown',
            'Options' =>get_customfield_id(),
            'Description' => 'Birthday date type the array number here',
        ),

:) 

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