Jump to content
  • 0

On select option chnage, change the inputs values


AmineBouhaddi1

Question

Hello, please I have started creating a new WHMCS module, I have predefined values for each package how can I set this predefined values on select option change ( i mean when I click and I change the option from the dropdown list ) 

 

<?php
/**
* Module Name : Centrix4WHMCS
* Author name : Amine Bouhaddi
* Phone Number :
* Email Adresse :
* Reason OF Creation :
* Version :
* More About me : @see
*/


if(!defined("WHMCS"))
  die("This File Cannot be accessed directly");


function centrix_MetaData(){
  return array(
    "DisplayName" => "Centrix",
    "APIVersion" => "1.1"
  );
}

/*
* Define Configuration Module
* Required Fieds :
* x :
* y :
* z :
* @return array
*/


function project_ConfigOptions(){
    $x = array(
      'Package' => array(
        'Type' => 'dropdown',
        'Loader' => 'project_LoaderFunction',
        'SimpleMode' => true
      ),
      'Maximum users' => array(
        'Type' => 'text',
        'Size' => 25,
        'SimpleMode' => true
      ),
      'Contacts & Leads' => array(
        'Type' => 'text',
        'Size' => 25,
        'SimpleMode' => true
      ),
      'Drive file storage' => array(
        'Type' => 'text',
        'Size' => 25,
        'SimpleMode' => true
      ),
      'Smartforms lead capture' => array(
        'Type' => 'text',
        'Size' => 25,
        'SimpleMode' => true
      ),
      'Email list Capacity' => array(
        'Type' => 'text',
        'Size' => 25,
        'SimpleMode' => true
      ),
      'Accounting soft Integration*' => array(
        'Type' => 'text',
        'Size' => 25,
        'SimpleMode' => true
      ),
      'Advanced filtering' => array(
        'Type' => 'text',
        'Size' => 25,
        'SimpleMode' => true
      ),
      'Sales & opportunity dashboard' => array(
        'Type' => 'text',
        'Size' => 25,
        'SimpleMode' => true
      ),
      'Mobile compatible' => array(
        'Type' => 'text',
        'Size' => 25,
        'SimpleMode' => true
      ),
      'Google Maps integration' => array(
        'Type' => 'text',
        'Size' => 25,
        'SimpleMode' => true
      ),
      'Customer document vault' => array(
        'Type' => 'text',
        'Size' => 25,
        'SimpleMode' => true
      ),
      'Sales material vault' => array(
        'Type' => 'text',
        'Size' => 25,
        'SimpleMode' => true
      ),
      'Import tool' => array(
        'Type' => 'text',
        'Size' => 25,
        'SimpleMode' => true
      ),
      'Reminders & notifications' => array(
        'Type' => 'text',
        'Size' => 25,
        'SimpleMode' => true
      ),
      'Task management & reminders' => array(
        'Type' => 'text',
        'Size' => 25,
        'SimpleMode' => true
      ),
      'Activity logs' => array(
        'Type' => 'text',
        'Size' => 25,
        'SimpleMode' => true
      ),
      'Email templates builder' => array(
        'Type' => 'text',
        'Size' => 25,
        'SimpleMode' => true
      ),
      'Built-in Gmail two-way sync' => array(
        'Type' => 'text',
        'Size' => 25,
        'SimpleMode' => true
      ),
      'Tasks and calendar integration	' => array(
        'Type' => 'text',
        'Size' => 25,
        'SimpleMode' => true
      ),
      'Emailing list engine' => array(
        'Type' => 'text',
        'Size' => 25,
        'SimpleMode' => true
      ),
      'Emailing list engine' => array(
        'Type' => 'text',
        'Size' => 25,
        'SimpleMode' => true
      ),
      '2-way email sync capacity' => array(
        'Type' => 'text',
        'Size' => 25,
        'SimpleMode' => true
      ),
      'Pipeline management' => array(
        'Type' => 'text',
        'Size' => 25,
        'SimpleMode' => true
      ),
      'Social media enrichment' => array(
        'Type' => 'text',
        'Size' => 25,
        'SimpleMode' => true
      ),
      'Custom fields' => array(
        'Type' => 'text',
        'Size' => 25,
        'SimpleMode' => true
      ),
      'Google Analytics integration' => array(
        'Type' => 'text',
        'Size' => 25,
        'SimpleMode' => true
      ),
      'Social profiling' => array(
        'Type' => 'text',
        'Size' => 25,
        'SimpleMode' => true
      ),
      'Role-based permissions' => array(
        'Type' => 'text',
        'Size' => 25,
        'SimpleMode' => true
      ),
      'Sales activity & forecast reports' => array(
        'Type' => 'text',
        'Size' => 25,
        'SimpleMode' => true
      ),
      'MS Office 365 two-way email sync' => array(
        'Type' => 'text',
        'Size' => 25,
        'SimpleMode' => true
      ),
      'Marketing automation rules engine' => array(
        'Type' => 'text',
        'Size' => 25,
        'SimpleMode' => true
      ),
      'Workflow automation' => array(
        'Type' => 'text',
        'Size' => 25,
        'SimpleMode' => true
      ),
      'Website & email event tracking' => array(
        'Type' => 'text',
        'Size' => 25,
        'SimpleMode' => true
      ),
      'Rule-based lead scoring' => array(
        'Type' => 'text',
        'Size' => 25,
        'SimpleMode' => true
      ),
      'Lead assignment rules' => array(
        'Type' => 'text',
        'Size' => 25,
        'SimpleMode' => true
      )
    );
    return $x;
}

function project_LoaderFunction(){
  // Make a call to the remote API endpoint
    $ch = curl_init('http://project.club/api.php');
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    $response = curl_exec($ch);

    // Check for any curl errors or an empty response
    if (curl_error($ch)) {
        throw new Exception('Unable to connect: ' . curl_errno($ch) . ' - ' . curl_error($ch));
    } elseif (empty($response)) {
        throw new Exception('Empty response');
    }

    // We're done with curl so we can release the resource now
    curl_close($ch);

    // Attempt to decode the response
    $packageNames = json_decode($response, true);

    // Check to make sure valid json was returned
    if (is_null($packageNames)) {
        throw new Exception('Invalid response format');
    }

    // Format the list of values for display
    // ['value' => 'Display Label']
    $list = [];
    foreach ($packageNames as $packageName) {
        $list[$packageName] = ucfirst($packageName);
    }

    return $list;
}







?>

 

Link to comment
Share on other sites

0 answers to this question

Recommended Posts

There have been no answers to this question yet

Join the conversation

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

Guest
Answer this question...

×   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