Jump to content

Fernandes Guimarães

Member
  • Posts

    2
  • Joined

  • Last visited

About Fernandes Guimarães

Fernandes Guimarães's Achievements

Junior Member

Junior Member (1/3)

0

Reputation

  1. I corrected the foreach funcion so that now it returns a proper "ID" => "Description" array of the email templates. But it sill stays as a text input field instead of a nice dropdown list. 'tam-s1' => array ( 'FriendlyName' => 'E-mail Template', 'Type' => 'text', 'Size' => '25', 'Loader' => function () { $templates = localAPI('GetEmailTemplates', array( 'type' => 'product' )); // Format the list of values for display // array ('ID' => 'Display Label'), foreach ( $templates['emailtemplates']['emailtemplate'] as $a ) { $list[$a['id']] = $a['name']; } return($list); }, 'SimpleMode' => true, ),
  2. I have some configuration fields in my addon, one of them I would like to be a dropdown of e-mail templates available in WHMCS. But no info on how to add a funcion in the oficial developer pages on how to setup such a field. Regardless I found another page explaining adding such a field for the rpovisioning module and tried to use it. Code below: // Select e-mail to send on trial start 'tam-s1' => array ( 'FriendlyName' => 'E-mail Template', 'Type' => 'text', 'Size' => '25', 'Loader' => function () { $command = 'GetEmailTemplates'; $postData = array( 'type' => 'general', ); $templates = localAPI($command, $postData); if ($templates['result'] == 'success') { echo 'Message sent successfully!'; } else { echo "An Error Occurred: " . $results['result']; } print_r($templates,true); // Format the list of values for display // array ('value' => 'Display Label'), $list = []; foreach ($templates as $emailtemplate) { $list[$emailtemplate['id']] = ucfirst($emailtemplate['name']); } return $list; }, 'SimpleMode' => true, ), But nothing really happens on the addon configuration page. The field in question prints out as a standard text field. Should I assume that the Loader only works within other fields and not the addon config fields? Or am I doing something wrong? Thanks in advance.
  3. Welcome to WHMCS.Community Fernandes Guimarães! We're glad you're here please take some time to familiarise yourself with the Community Rules & Guidelines and take a moment to introduce yourself to other WHMCS.Community members in the Introduce Yourself Board.

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