root 4 лет назад
Сommit
44b96f5c57
17 измененных файлов с 1889 добавлено и 0 удалено
  1. 24 0
      ClassLoader.php
  2. 146 0
      ExistingDomains.php
  3. 325 0
      hooks.php
  4. 1 0
      index.php
  5. 5 0
      lang/english.php
  6. 5 0
      lang/german.php
  7. 1 0
      lang/index.php
  8. BIN
      logo.png
  9. 63 0
      templates/boxs.tpl
  10. 86 0
      templates/control.tpl
  11. 87 0
      templates/default.tpl
  12. 538 0
      templates/flowcart.tpl
  13. 3 0
      templates/index.php
  14. 10 0
      templates/lagom-header.tpl
  15. 460 0
      templates/lagom.tpl
  16. 109 0
      templates/other.tpl
  17. 26 0
      whmcs.json

+ 24 - 0
ClassLoader.php

@@ -0,0 +1,24 @@
+<?php //ICB0 71:0                                                             ?><?php //007bd
+// WS Existing Domains 2.4.1
+// 
+// Copyright 2020 WHMCS Services
+// 
+// This license permits you to install this software on a single domain, single website, with a single IP address. You may not remove any copyright information either from the php source code, or from the HTML source code.
+// 
+// You may not reverse engineer, decompile, defeat licensing, or disassemble this software product or software licensing system in any way.  WHMCS Services may terminate this license if for any reason you do not comply with the terms and conditions as set forth in the end-user license agreement (EULA) included with this software to which you have agreed to by posessing, installing, or using this software.
+if(!extension_loaded('ionCube Loader')){$__oc=strtolower(substr(php_uname(),0,3));$__ln='ioncube_loader_'.$__oc.'_'.substr(phpversion(),0,3).(($__oc=='win')?'.dll':'.so');if(function_exists('dl')){@dl($__ln);}if(function_exists('_il_exec')){return _il_exec();}$__ln='/ioncube/'.$__ln;$__oid=$__id=realpath(ini_get('extension_dir'));$__here=dirname(__FILE__);if(strlen($__id)>1&&$__id[1]==':'){$__id=str_replace('\\','/',substr($__id,2));$__here=str_replace('\\','/',substr($__here,2));}$__rd=str_repeat('/..',substr_count($__id,'/')).$__here.'/';$__i=strlen($__rd);while($__i--){if($__rd[$__i]=='/'){$__lp=substr($__rd,0,$__i).$__ln;if(file_exists($__oid.$__lp)){$__ln=$__lp;break;}}}if(function_exists('dl')){@dl($__ln);}}else{die('The file '.__FILE__." is corrupted.\n");}if(function_exists('_il_exec')){return _il_exec();}echo("Site error: the ".(php_sapi_name()=='cli'?'ionCube':'<a href="http://www.ioncube.com">ionCube</a>')." PHP Loader needs to be installed. This is a widely used PHP extension for running ionCube protected PHP code, website security and malware blocking.\n\nPlease visit ".(php_sapi_name()=='cli'?'get-loader.ioncube.com':'<a href="http://get-loader.ioncube.com">get-loader.ioncube.com</a>')." for install assistance.\n\n");exit(199);
+?>
+HR+cPuCsWetR4dUYee0NhXtcMx/iVWb+E+Md+UACo4f4azrjKtGNgvKH14cNYdakQAAxqv04igEa
+kMTdb05WaiNV2m1Do9r+v0Ygs07qtCtkxiip2njWB1E1dN+ggcq7XTN2f5mEhJNcpJMT9We1XN7F
+Qor/8bKA8MrDNX+PnH+nvbcheoHQ/l+3GvbdJ5XS2lt/Uy4CDS6byteBYdqlESl+VW0AThznEDMy
+AuO4K+z+OXsB0rnTDTqI3nwS4/1zTcxdq3gX1YPYHUZXDQnQdKql6R/Z8oAiOlGsKSCkTqQVx5uV
+U+S37V/m/FKEZHuF/+LGLqyvWPejZ4Ina/6fwBoGp4u+EBZgYahokw1E9GU8c+6HFVKSrX5PEkFV
+FL3i03Bd64MX1Ei14xoqvuBmcQa1GO6biQARgbpmCMTmSDwTs18/r7ruJ3KBdp7FJdaNp1RPD3JS
+7pa3yxr06rpDM0pofOwWa+PMItz81nfFsQIN3L3z7EQXYuj07p0w/i81E/7h6JBiNH0WZ3hIK0/0
+nL6T2GtTOksCxTjkgmlc26js/p5o+BVbDIuDMmn0cTDXbz+9WSbd3edfA8Y5d47NOi3NSHxbJNag
++xTRFRZQCuIDY07KW1baPrf24ITVEGilhGSSggGxfdnj9V21p+xx7upftrS/tfTS5dxE/6CHZ6IB
+5791bIXMndkUtvUUwOAD0mhPtSd7+uzfZLwP7gwo6/G8ZefzEAvvbC8w2YgKWWjceBz0d4i6AoVj
+vZV3s1kuRFqK1jW3TdIVIH/2m53UXKRzZdhWY45BzIWVqB2tTeKdMNgHD4KVx5M7bDR1i1+Rpw/F
+vBiQSF/6cAADg443X3dbicwB6mlsw2B2Ck7ihdWBwQWXLCLpGDKa09dVZhfWd/ck2Nytze76OP6C
+Y3a3kru6IicoAoE36d4iHzX1NCPHxclP9KbFh/WQSl8xbTgNR0hsl3zG3a38yfmKhbr7ImNY1YfI
+T8ev03LkrW4g5EP8PAl36u0pjnKvqYSZzFaQSMZgP6Wi6+DNr+h4W2ag/DrZCvhi0KRJf0qGRH8=

+ 146 - 0
ExistingDomains.php

@@ -0,0 +1,146 @@
+<?php
+/* * ********************************************************************
+ * Existing Domains by WHMCS Services
+ * Copyright  WHMCS Services,  	 All Rights Reserved
+ *
+ * Created By WHMCSServices      http://www.whmcsservices.com
+ * Contact:                      dev@whmcsservices.com
+ *
+ * This software is furnished under a license and may be used and copied
+ * only  in  accordance  with  the  terms  of such  license and with the
+ * inclusion of the above copyright notice.  This software  or any other
+ * copies thereof may not be provided or otherwise made available to any
+ * other person.  No title to and  ownership of the  software is  hereby
+ * transferred.
+ * ******************************************************************** */
+
+if (!defined("WHMCS"))
+    die("This file cannot be accessed directly");
+
+use Illuminate\Database\Capsule\Manager as Capsule;
+
+function ExistingDomains_config()
+{
+    $configarray = array(
+        "name" => "Existing Domains",
+        "description" => "This module will give the customers the ability to use domains they have already purchased. <br>For more info visit our <b><a href='https://www.whmcsservices.community/forumdisplay.php?fid=28' target='_blank'>forum</a></b> ",
+        "version" => "2.4.1",
+        "author" => "<a href='https://www.whmcsservices.com/' target='_blank'><img width='100px' src='data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAARYAAABKCAMAAABJqItFAAAC31BMVEUAAAAjHyBMTE0wLS89Oz07OTtOTlC2HSUmIiPgHSU9Oz3qHSVBP0ElISLcHSWtHSWtHSU6ODkyMDHaHSWuHSXFHSVLSkw4NTfEHSWjHSUsKSo0MjPmHSUnJCVQUFKiHSVHR0jjHSVGRUbSHSUuKyxBQEGuHSXvHSXtHSWnHSU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Pny5cuXL+/rd/0dtIDpyDvIAAAAAElFTkSuQmCC'></a>",
+        "fields" => array(
+            "doption" => array("FriendlyName" => "Duplicate Domains", "Type" => "dropdown", "Options" => "Allow Duplicate,Same product domain,All product domain", "Description" => '<br>Allow Duplicate - Allow clients to choose any domains are in they account<br>All product domain - Don\'t allow the same domain name for all products. Domain names must be unique on the system.<br>Same product domain - Don\'t allow the same domain for the same product. Domain names must be unique per product/service.'),
+            "subdomain" => array("FriendlyName" => 'Sub domains', "Type" => 'yesno', "Description" => 'Allow clients to choose sub domains that are already assigned to a hosting account')
+        )
+    );
+
+    return $configarray;
+}
+
+function ExistingDomains_activate()
+{
+    Capsule::table('tblconfiguration')->where('setting', 'AllowDomainsTwice')->update([
+        'value' => ''
+    ]);
+    return array('status' => 'success', 'description' => 'WS Existing Domains module activated');
+}
+
+function ExistingDomains_deactivate()
+{
+    Capsule::table('tblconfiguration')->where('setting', 'AllowDomainsTwice')->update([
+        'value' => 'on'
+    ]);
+    return array('status' => 'success', 'description' => 'WS Existing Domains deactivated');
+}
+
+function ExistingDomains_output()
+{
+    $vchk = '';
+    if (!isset($_SESSION['exdscheckversion'])) {
+        $sversion = curlCall('https://www.whmcsservices.com/members/modules/addons/modulesmanager/versioncheck.php?check=ExistingDomains', '');
+        $lversion = ExistingDomains_config();
+        $sversion = json_decode($sversion, true);
+        $sversi = str_replace('.', '', $sversion['version']);
+        $lversi = str_replace('.', '', $lversion['version']);
+        if ($lversi >= $sversi) {
+            $vchk = '<div  style="height:61px">Your addon version is update with last version</div><a class="btn btn-success" href="#">Module Version : ' . $sversion['version'] . '</a>';
+        } else {
+            $vchk = '<div  style="height:61px">Your addon version isn\'t up to date</div> <a class="label label-danger" href="#">Local Module version : ' . $lversion['version'] . ', Please update addon to <br>Version : ' . $sversion['version'] . '</a>';
+        }
+        $_SESSION['exdscheckversion'] = $vchk;
+    }
+    echo '<div style="background-color: whitesmoke;">
+<style>.orange {
+    color:#946780;
+}
+.subtitle {
+    font-size: 16px;
+    font-weight: 700;
+}
+
+.padding20 {
+    padding:20px;
+}
+</style>
+	<div class="row text-center" style="padding-top:8px;padding-left:3px;padding-right:3px">
+		    <div class="col-md-3 ">
+		<span style="font-size: 55px" class="fa fa-cube orange"></span>
+		<h2 class="subtitle">Module Version</h2>
+		' . ((isset($_SESSION['exdscheckversion'])) ? $_SESSION['exdscheckversion'] : $vchk) . '
+		</div>
+    		<div class="col-md-3">
+    		<span style="font-size: 55px" class="fa fa-info-circle orange" aria-hidden="true"></span>
+    		<h2 class="subtitle">Changelog</h2>
+    		<div  style="height:61px">Our changelogs provide details about updates and fixes in each version of our module</div>
+            <a class="btn btn-default" href="https://www.whmcsservices.community/showthread.php?tid=88" target="_blank">Changelog</a>
+    		</div>
+    		<div class="col-md-3">
+    		<span style="font-size: 55px" class="fa fa-graduation-cap orange"></span>
+    		<h2 class="subtitle">Knowledgebase</h2>
+    		<div style="height:61px">Helpful article and guide on how to use this module<br>
+            </div>
+            <a class="btn btn-default" href="https://www.whmcsservices.community/forumdisplay.php?fid=28" target="_blank">Knowledgebase Base</a>
+    		</div>
+    		<div class="col-md-3" style="margin-bottom: 40px;">
+    		<span style="font-size: 55px" class="fa fa-shopping-bag orange"></span>
+    		<h2 class="subtitle">WHMCS Marketplace</h2>
+    		<div  style="height:61px">Visit our Marketplace portfolio for qualify WHMCS Module<br>
+                </div>
+            <a class="btn btn-default" target="_blank" href="https://marketplace.whmcs.com/group/whmcsservices">Our Portfolio</a>
+    		</div>
+
+	</div>
+	<div class="row text-center">
+
+		    <div class="col-md-3">
+		<span style="font-size: 55px" class="fa fa-plus-circle orange"></span>
+		<h2 class="subtitle">Feature Request</h2>
+		<div style="height:61px">Share ideas, discuss on requests from other users in community<br>
+</div>
+                <a class="btn btn-default" target="_blank" href="http://requests.whmcsservices.com/">Open Request</a>
+		</div>
+    		<div class="col-md-3">
+    		<span style="font-size: 55px" class="fa fa-tasks orange"></span>
+    		<h2 class="subtitle">Support / Bugs Report</h2>
+    		<div style="height:61px">Contact us of support or bugs<br>
+                </div>
+                <a class="btn btn-default" target="_blank" href="https://www.whmcsservices.com/members/submitticket.php?step=2&deptid=8&customfield[1191]=ExistingDomains&customfield[1370]=' . phpversion() . '&customfield[1369]=' . $CONFIG['Version'] . '&customfield[147]=' . $CONFIG['SystemURL'] . '">Open Ticket</a>
+    		</div>
+    		<div class="col-md-3">
+    		<span style="font-size: 55px" class="fa fa-star orange"></span>
+    		<h2 class="subtitle">Rate this module</h2>
+    		<div style="height:61px">Rate this module put Share your experience with everyone
+</div>
+                  <a class="btn btn-default" target="_blank" href="https://marketplace.whmcs.com/product/1578#reviews">Rate now!</a>
+
+    		</div>
+    		<div class="col-md-3" style="margin-bottom: 10px;">
+    		<span style="font-size: 55px" class="fa fa-envelope orange"></span>
+    		<h2 class="subtitle">Contact Us</h2>
+    		<div style="height:61px">Need any custom developer from your WHMCS?<br>
+                </div>
+                <a class="btn btn-default" target="_blank" href="https://www.whmcsservices.com/members/submitticket.php?step=2&deptid=11">Open Ticket</a>
+    		</div>
+
+	</div>
+</div>';
+    return '';
+}

+ 325 - 0
hooks.php

@@ -0,0 +1,325 @@
+<?php
+/* * ********************************************************************
+ * Existing Domains by WHMCS Services
+ * Copyright  WHMCS Services,  	 All Rights Reserved
+ *
+ * Created By WHMCSServices      http://www.whmcsservices.com
+ * Contact:                      dev@whmcsservices.com
+ *
+ * This software is furnished under a license and may be used and copied
+ * only  in  accordance  with  the  terms  of such  license and with the
+ * inclusion of the above copyright notice.  This software  or any other
+ * copies thereof may not be provided or otherwise made available to any
+ * other person.  No title to and  ownership of the  software is  hereby
+ * transferred.
+ * ******************************************************************** */
+
+use Illuminate\Database\Capsule\Manager as Capsule;
+
+if (!defined("WHMCS"))
+    die("This file cannot be accessed directly");
+
+add_hook('ClientAreaPageCart', 145144, function($vars) {
+    global $CONFIG;
+    $clang = $CONFIG['Language'];
+    if (isset($_SESSION['uid'])) {
+        $litem = Capsule::table('tblclients')->where('id', $_SESSION['uid'])->where('language', '<>', '')->value('language');
+        if ($litem) {
+            $clang = $litem;
+        }
+    }
+    if (isset($_SESSION['Language'])) {
+        $clang = $_SESSION['Language'];
+    }
+    if (file_exists(ROOTDIR . "/modules/addons/ExistingDomains/lang/" . $clang . ".php")) {
+        include(ROOTDIR . "/modules/addons/ExistingDomains/lang/" . $clang . ".php");
+    } elseif (file_exists(ROOTDIR . "/modules/addons/ExistingDomains/lang/" . $CONFIG['Language'] . ".php")) {
+        include(ROOTDIR . "/modules/addons/ExistingDomains/lang/" . $CONFIG['Language'] . ".php");
+    } elseif (file_exists(ROOTDIR . "/modules/addons/ExistingDomains/lang/english.php")) {
+        include(ROOTDIR . "/modules/addons/ExistingDomains/lang/english.php");
+    }
+
+    if ($vars['productinfo']['pid'] && $_SESSION['uid']) {
+        $EDMODULE = array();
+        $results = Capsule::table('tbladdonmodules')->where('module', 'ExistingDomains')->get();
+        foreach ($results as $data) {
+            $setting = $data->setting;
+            $value = $data->value;
+            $EDMODULE[$setting] = $value;
+        }
+
+        if ($EDMODULE['doption'] != '') {
+            $edresult = Capsule::table('tbldomains')->where('userid', $_SESSION['uid'])->where('status', 'Active')->get();
+        }
+
+        foreach ($edresult as $eddata) {
+            $returns['existingdomains'][] = $eddata->domain;
+        }
+
+        $returns['EDLANG'] = $_ADDONLANG;
+        $returns['WSEXISTING'] = $EDMODULE;
+
+        return $returns;
+    }
+});
+
+
+add_hook("ClientAreaFooterOutput", 1, function($vars) {
+    global $CONFIG;
+    if ("flowcart7" == $CONFIG['OrderFormTemplate']) {
+        return '';
+    }
+    if ("lagom" == $CONFIG['OrderFormTemplate']) {
+        return '';
+    }
+    if (!isset($_SESSION['uid'])) {
+        return '';
+    }
+    $wscurrentfile = App::getCurrentFilename();
+    if ($wscurrentfile != 'cart') {
+        return '';
+    }
+    $clang = $CONFIG['Language'];
+    $litem = Capsule::table('tblclients')->where('id', $_SESSION['uid'])->where('language', '<>', '')->value('language');
+    if ($litem) {
+        $clang = $litem;
+    }
+    if (isset($_SESSION['Language'])) {
+        $clang = $_SESSION['Language'];
+    }
+    if (file_exists(ROOTDIR . "/modules/addons/ExistingDomains/lang/" . $clang . ".php")) {
+        include(ROOTDIR . "/modules/addons/ExistingDomains/lang/" . $clang . ".php");
+    } elseif (file_exists(ROOTDIR . "/modules/addons/ExistingDomains/lang/" . $CONFIG['Language'] . ".php")) {
+        include(ROOTDIR . "/modules/addons/ExistingDomains/lang/" . $CONFIG['Language'] . ".php");
+    } elseif (file_exists(ROOTDIR . "/modules/addons/ExistingDomains/lang/english.php")) {
+        include(ROOTDIR . "/modules/addons/ExistingDomains/lang/english.php");
+    }
+    return <<<EOL
+<script type="text/javascript">
+jQuery('#frmProductDomain').submit(function (e) {
+    e.preventDefault();
+    $(".errordomainnamepws").remove();
+    var btnSearchObj = jQuery(this).find('button[type="submit"]'),
+        domainSearchResults = jQuery("#DomainSearchResults"),
+        spotlightTlds = jQuery('#spotlightTlds'),
+        suggestions = jQuery('#domainSuggestions'),
+        btnDomainContinue = jQuery('#btnDomainContinue'),
+        domainoption = jQuery(".domain-selection-options input:checked").val(),
+        sldInput = jQuery("#" + domainoption + "sld"),
+        sld = sldInput.val(),
+        tld = '',
+        pid = jQuery('#frmProductDomainPid').val(),
+        tldInput = '';
+    if (domainoption == 'existing_domain') {
+
+        sldInput = jQuery("#existing_domainsld option:selected");
+        sld = sldInput.text();
+        var splitDomain = sld.split('.');
+        sld = splitDomain[0];
+        splitDomain.splice(0, 1);
+        tld = '.' + splitDomain.join(".");
+
+        jQuery('.domain-lookup-other-loader').show();
+        jQuery('.domain-lookup-loader').show();
+
+        btnDomainContinue.addClass('hidden').attr('disabled', 'disabled');
+
+        var otherDomain = jQuery.post(
+            'cart.php',
+            {
+               token: csrfToken,
+               a: 'checkDomain',
+               type: "owndomain",//domainoption,
+               pid: pid,
+               wscheck: 1,
+               domain: sld + tld
+            },
+            'json'
+        );
+
+        otherDomain.done(function(data) {
+            if (typeof data != 'object' || data.result.length == 0) {
+                jQuery('.domain-lookup-subdomain-loader').hide();
+                return;
+            }
+            if(typeof data.result.wsres !== 'undefined' && data.result.wsres.length > 0){
+                $(".errordomainnamepws").remove();
+                $('#frmProductDomainSelections').prepend('<div class="errordomainnamepws alert alert-danger"><strong>'+data.result.wsdomain+'</strong> {$_ADDONLANG['errordomain']}</div>');
+            }
+            jQuery.each(data.result, function(index, result) {
+                if (result.status === true) {
+                    window.location = 'cart.php?a=confproduct&i=' + result.num;
+                } else {
+                    jQuery('.domain-lookup-primary-loader').hide();
+                    jQuery('#primaryLookupResult').removeClass('hidden').show().find('.domain-invalid').show();
+                }
+            });
+
+            }).always(function(){
+                hasProductDomainLookupEnded(1, btnSearchObj);
+            });
+        }else if(domainoption == 'subexisting_domain'){
+    if($("#subdomainexisting_domaindomains").val() === ''){
+        $('#subdomainexisting_domaindomains').tooltip('show');
+    return 0;
+     }
+            jQuery('.domain-lookup-other-loader').show();
+            jQuery('.domain-lookup-loader').show();
+
+        btnDomainContinue.addClass('hidden').attr('disabled', 'disabled');
+        var ddsubdomain = $("#subexisting_domaindomainid").val();
+        var otherDomain = jQuery.post(
+            'cart.php',
+            {
+               token: csrfToken,
+               a: 'checkDomain',
+               type: "owndomain",//domainoption,
+               pid: pid,
+               wscheck: 1,
+               issubdomain: 1,
+               domain: ddsubdomain
+            },
+            'json'
+        );
+
+        otherDomain.done(function(data) {
+            if (typeof data != 'object' || data.result.length == 0) {
+                jQuery('.domain-lookup-subdomain-loader').hide();
+                return;
+            }
+            if(typeof data.result.wsres !== 'undefined' && data.result.wsres.length > 0){
+                $(".errordomainnamepws").remove();
+                $('#frmProductDomainSelections').prepend('<div class="errordomainnamepws alert alert-danger"><strong>'+data.result.wsdomain+'</strong>  {$_ADDONLANG['errordomain']}.</div>');
+            }
+            jQuery.each(data.result, function(index, result) {
+                if (result.status === true) {
+                    window.location = 'cart.php?a=confproduct&i=' + result.num;
+                } else {
+                    jQuery('.domain-lookup-primary-loader').hide();
+                    jQuery('#primaryLookupResult').removeClass('hidden').show().find('.domain-invalid').show();
+                }
+            });
+
+            }).always(function(){
+                hasProductDomainLookupEnded(1, btnSearchObj);
+            });
+        }
+
+    btnDomainContinue.removeClass('hidden');
+
+});
+</script>
+EOL;
+});
+$wscurrentfile = App::getCurrentFilename();
+
+function ExistingDomains_checkdomainvalid()
+{
+    $EDMODULE = array();
+    $results = Capsule::table('tbladdonmodules')->where('module', 'ExistingDomains')->get();
+    foreach ($results as $data) {
+        $setting = $data->setting;
+        $value = $data->value;
+        $EDMODULE[$setting] = $value;
+    }
+    $wcddomain = (string) strip_tags(trim($_REQUEST['domain']));
+
+    if ($EDMODULE['doption'] != 'Allow Duplicate') {
+        $wsdvccheck = false;
+        $wcduseri = (int) $_SESSION['uid'];
+        $wcdpid = (int) $_REQUEST['pid'];
+        if ($EDMODULE['doption'] == 'Same product domain') {
+            $wcditem = Capsule::table('tblhosting')->where('userid', $wcduseri)->where('packageid', $wcdpid)->where('domain', $wcddomain)->where('domainstatus', 'Active')->count();
+            if ($wcditem) {
+                $wsdvccheck = TRUE;
+            }
+        }
+        if ($EDMODULE['doption'] == 'All product domain') {
+            $wcditem = Capsule::table('tblhosting')->where('userid', $wcduseri)->where('domain', $wcddomain)->where('domainstatus', 'Active')->count();
+            if ($wcditem) {
+                $wsdvccheck = TRUE;
+            }
+        }
+        if ($wsdvccheck) {
+            $result = array(
+                'status' => FALSE,
+                'result' => '',
+                'wsres' => 'notallowed',
+                'wsdomain' => $wcddomain,
+            );
+            $response = new \WHMCS\Http\JsonResponse(array("result" => $result), 200, array("Content-Type" => "application/json"));
+            $response->send();
+            \WHMCS\Terminus::getInstance()->doExit();
+        }
+        if (isset($_REQUEST['issubdomain']) && $_REQUEST['issubdomain'] != '') {
+            $resss = wscheckIncart($wcddomain);
+            $response = new \WHMCS\Http\JsonResponse(array("result" => array("result" => $resss)), 200, array("Content-Type" => "application/json"));
+            $response->send();
+            \WHMCS\Terminus::getInstance()->doExit();
+        }
+    }
+}
+
+function wscartPreventDuplicateProduct($domain)
+{
+    if ($domain) {
+        $domains = array();
+        foreach ($_SESSION["cart"]["products"] as $k => $values) {
+            $domains[$k] = $values["domain"];
+        }
+        if (in_array($domain, $domains)) {
+            $i = array_search($domain, $domains);
+            if ($i !== false) {
+                unset($_SESSION["cart"]["products"][$i]);
+                $_SESSION["cart"]["products"] = array_values($_SESSION["cart"]["products"]);
+            }
+        }
+    }
+}
+
+function wscheckIncart($domain)
+{
+    $orderForm = new \WHMCS\OrderForm();
+    $productId = (int) $_REQUEST["pid"];
+    $productInfo = $orderForm->setPid($productId);
+    $passedVariables = $_SESSION["cart"]["passedvariables"];
+    unset($_SESSION["cart"]["passedvariables"]);
+    wscartPreventDuplicateProduct($domain);
+    $productArray = array("pid" => $productId, "domain" => $domain, "billingcycle" => $passedVariables["billingcycle"] ?: $orderForm->validateBillingCycle(""), "configoptions" => $passedVariables["configoption"], "customfields" => $passedVariables["customfield"], "addons" => $passedVariables["addons"], "server" => "", "noconfig" => true, "skipConfig" => isset($passedVariables["skipconfig"]) && $passedVariables["skipconfig"]);
+    if (isset($passedVariables["bnum"])) {
+        $productArray["bnum"] = $passedVariables["bnum"];
+    }
+    if (isset($passedVariables["bitem"])) {
+        $productArray["bitem"] = $passedVariables["bitem"];
+    }
+    $_SESSION["cart"]["newproduct"] = true;
+    $updatedExistingQuantity = false;
+    if ($productInfo["allowqty"]) {
+        foreach ($_SESSION["cart"]["products"] as &$cart_prod) {
+            if ($productId == $cart_prod["pid"]) {
+                if (empty($cart_prod["qty"])) {
+                    $cart_prod["qty"] = 1;
+                }
+                $cart_prod["qty"] ++;
+                if ($productInfo["stockcontrol"] && $productInfo["qty"] < $cart_prod["qty"]) {
+                    $cart_prod["qty"] = $productInfo["qty"];
+                }
+                $updatedExistingQuantity = true;
+                break;
+            }
+        }
+    }
+    if (!$updatedExistingQuantity) {
+        $_SESSION["cart"]["products"][] = $productArray;
+    }
+    $newProductIValue = count($_SESSION["cart"]["products"]) - 1;
+    if (isset($passedVariables["skipconfig"]) && $passedVariables["skipconfig"]) {
+        unset($_SESSION["cart"]["products"][$newProductIValue]["noconfig"]);
+        $_SESSION["cart"]["lastconfigured"] = array("type" => "product", "i" => $newProductIValue);
+    }
+    $searchResult = array("status" => true, "num" => $newProductIValue);
+    return $searchResult;
+}
+if ($wscurrentfile == 'cart' && isset($_SESSION['uid']) && isset($_REQUEST['a']) && $_REQUEST['a'] == "checkDomain" && isset($_REQUEST['wscheck'])) {
+    ExistingDomains_checkdomainvalid();
+}

+ 1 - 0
index.php

@@ -0,0 +1 @@
+<p align="center"><b>WS Existing Domain for WHMCS 2.4.0</b></p>

+ 5 - 0
lang/english.php

@@ -0,0 +1,5 @@
+<?php
+$_ADDONLANG['UseaDomainIhaveAlreadyPurchased'] = "Use a domain I have already purchased";
+$_ADDONLANG['UseaSubDomainIhaveAlreadyPurchased'] = "Use a sub domain of domain I have already purchased";
+$_ADDONLANG['UseaSubDomainTooltip'] = "Please enter your sub domain";
+$_ADDONLANG['errordomain'] = " not acceptable because already in use";

+ 5 - 0
lang/german.php

@@ -0,0 +1,5 @@
+<?php
+$_ADDONLANG['UseaDomainIhaveAlreadyPurchased'] = "Ich möchte eine bereits erworbene Domain benutzen";
+$_ADDONLANG['UseaSubDomainIhaveAlreadyPurchased'] = "Ich möchte eine bereits erworbene Subdoain benutzen";
+$_ADDONLANG['UseaSubDomainTooltip'] = "Bitte Subdomain eingeben";
+$_ADDONLANG['errordomain'] = " nicht möglich, ist bereits in Benutzung";

+ 1 - 0
lang/index.php

@@ -0,0 +1 @@
+<p align="center"><b>WS Existing Domain for WHMCS 2.4.0</b></p>


+ 63 - 0
templates/boxs.tpl

@@ -0,0 +1,63 @@
+{if $existingdomains}
+    <div class="field-row clearfix">
+        <label class="radio-inline product-radio"><input type="radio" onclick="chooseDomainReg('existing_domain')" name="domainoption" value="incart" id="selexisting_domain"{if $domainoption eq "existing_domain"} checked{/if} />{$EDLANG.UseaDomainIhaveAlreadyPurchased}</label>
+        <div class="row domain-option line-padded{if $domainoption neq "existing_domain"} hidden{/if}" id="domopt-existing_domain">
+            <div class="col-sm-1 col-sm-offset-2 col-xs-3"><p class="form-control-static text-right">www.</p></div>
+            <div class="col-sm-5 col-xs-6">
+                <select id="existing_domainsld" name="incartdomain" class="form-control">
+                    {foreach key=num item=existingdomain from=$existingdomains}
+                        <option value="{$existingdomain}">{$existingdomain}</option>
+                    {/foreach}
+                </select> 
+            </div>
+        </div>
+    </div>
+    {if $WSEXISTING.subdomain}
+        <div class="field-row clearfix">
+            <label class="radio-inline product-radio"><input type="radio" onclick="chooseDomainReg('subexisting_domain')" name="domainoption" value="incart" id="selsubexisting_domain"{if $domainoption eq "subexisting_domain"} checked{/if} />{$EDLANG.UseaSubDomainIhaveAlreadyPurchased}</label>
+            <div class="row domain-option line-padded{if $domainoption neq "subexisting_domain"} hidden{/if}" id="domopt-subexisting_domain">
+                <div class="col-sm-1 col-sm-offset-2 col-xs-3"><p class="form-control-static text-right">www.</p></div>
+                <div class="col-sm-8 col-xs-6">
+                    <div class="row domains-row">
+                        <div class="col-xs-2 text-right">
+                            <input name="subdomainexisting_domaindomain" autocapitalize="none" data-toggle="tooltip" data-placement="top" data-trigger="manual" title="{$EDLANG.UseaSubDomainTooltip}" id="subdomainexisting_domaindomains" class="form-control">
+                        </div>
+                        <div class="col-xs-1 text-right" style="padding-right: 0px;padding-left: 0px;width: 2%;">
+                            <p class="form-control-static">.</p>
+                        </div>                                          
+                        <div class="col-xs-6">
+                            <input name="incartdomain" type="hidden" value="" id="subexisting_domaindomainid">
+                            <select id="subexisting_domainsld" name="subexisting_domaindomain" class="form-control">
+                                {foreach key=num item=existingdomain from=$existingdomains}
+                                    <option data-oldv="{$existingdomain}" value="{$existingdomain}">{$existingdomain}</option>
+                                {/foreach}
+                            </select>                                           
+                        </div>
+                    </div>
+                </div>
+            </div>
+        </div>     
+    {/if}
+    <script>
+        $(document).ready(function () {
+            $("#subdomainexisting_domaindomains").on("keyup", function () {
+                if ($("#subdomainexisting_domaindomains").val() !== '') {
+                    $('#subdomainexisting_domaindomains').tooltip('hide');
+                    var oldvv = $("#subexisting_domainsld").find("option:selected").data("oldv");
+                    $("#subexisting_domaindomainid").val($("#subdomainexisting_domaindomains").val() + '.' + oldvv);
+                } else {
+                    $("#subexisting_domaindomainid").val('');
+                }
+            });
+            $("#subexisting_domainsld").on("change", function () {
+                if ($("#subdomainexisting_domaindomains").val() !== '') {
+                    var oldvv = $("#subexisting_domainsld").find("option:selected").data("oldv");
+                    $("#subexisting_domaindomainid").val($("#subdomainexisting_domaindomains").val() + '.' + oldvv);
+                } else {
+                    $("#subexisting_domaindomainid").val('');
+                }
+            });
+        });
+    </script>
+{/if}               
+

+ 86 - 0
templates/control.tpl

@@ -0,0 +1,86 @@
+{if $existingdomains}
+    <div class="option">
+        <label class="radio-icheck">
+            <input type="radio" class="icheck cpdoption" name="domainoption" value="existing_domain" id="selexisting_domain"{if $domainoption eq "existing_domain"} checked{/if} />{$EDLANG.UseaDomainIhaveAlreadyPurchased}
+        </label>
+        <div class="domain-input-group clearfix" id="domainexisting_domain">
+            <div class="row">
+                <div class="col-sm-9">
+                    <div class="row domains-row">
+                        <div class="col-xs-2 text-right">
+                            <p class="form-control-static">www.</p>
+                        </div>
+                        <div class="col-xs-7">
+                            <select id="existing_domainsld" name="existing_domaindomain" class="form-control">
+                                {foreach key=num item=existingdomain from=$existingdomains}
+                                    <option value="{$existingdomain}">{$existingdomain}</option>
+                                {/foreach}
+                            </select>                                           
+                        </div>
+                    </div>
+                </div>
+                <div class="col-sm-2">
+                    <button type="submit" id="b_existing_domain" class="btn btn-primary btn-block">
+                        {$LANG.orderForm.use}
+                    </button>
+                </div>
+            </div>
+        </div>
+    </div>
+    {if $WSEXISTING.subdomain}
+        <div class="option" class="radio-icheck">
+            <label class="radio-icheck">
+                <input class="icheck cpdoption" type="radio" name="domainoption" value="subexisting_domain" id="selsubexisting_domain"{if $domainoption eq "subexisting_domain"} checked{/if} />{$EDLANG.UseaSubDomainIhaveAlreadyPurchased}
+            </label>
+            <div class="domain-input-group clearfix" id="domainsubexisting_domain">
+                <div class="row">
+                    <div class="col-sm-9">
+                        <div class="row domains-row">
+                            <div class="col-xs-2 text-right">
+                                <input name="subdomainexisting_domaindomain" autocapitalize="none" data-toggle="tooltip" data-placement="top" data-trigger="manual" title="{$EDLANG.UseaSubDomainTooltip}" id="subdomainexisting_domaindomains" class="form-control">
+                            </div>
+                            <div class="col-xs-1 text-right" style="padding-right: 0px;padding-left: 0px;width: 2%;">
+                                <p class="form-control-static">.</p>
+                            </div>                                          
+                            <div class="col-xs-6">
+                                <input name="subexisting_domaindomain" type="hidden" value="" id="subexisting_domaindomainid">
+                                <select id="subexisting_domainsld" name="subexisting_domaindomain" class="form-control">
+                                    {foreach key=num item=existingdomain from=$existingdomains}
+                                        <option data-oldv="{$existingdomain}" value="{$existingdomain}">{$existingdomain}</option>
+                                    {/foreach}
+                                </select>                                           
+                            </div>
+                        </div>
+                    </div>
+                    <div class="col-sm-2">
+                        <button type="submit" id="b_subexisting_domain" class="btn btn-primary btn-block">
+                            {$LANG.orderForm.use}
+                        </button>
+                    </div>
+                </div>
+            </div>
+        </div>
+    {/if}
+    <script>
+        $(document).ready(function () {
+            $("#subdomainexisting_domaindomains").on("keyup", function () {
+                if ($("#subdomainexisting_domaindomains").val() !== '') {
+                    $('#subdomainexisting_domaindomains').tooltip('hide');
+                    var oldvv = $("#subexisting_domainsld").find("option:selected").data("oldv");
+                    $("#subexisting_domaindomainid").val($("#subdomainexisting_domaindomains").val() + '.' + oldvv);
+                } else {
+                    $("#subexisting_domaindomainid").val('');
+                }
+            });
+            $("#subexisting_domainsld").on("change", function () {
+                if ($("#subdomainexisting_domaindomains").val() !== '') {
+                    var oldvv = $("#subexisting_domainsld").find("option:selected").data("oldv");
+                    $("#subexisting_domaindomainid").val($("#subdomainexisting_domaindomains").val() + '.' + oldvv);
+                } else {
+                    $("#subexisting_domaindomainid").val('');
+                }
+            });
+        });
+    </script>
+{/if}               
+

+ 87 - 0
templates/default.tpl

@@ -0,0 +1,87 @@
+{if $existingdomains}
+    <div class="option">
+        <label>
+            <input type="radio" name="domainoption" value="existing_domain" id="selexisting_domain"{if $domainoption eq "existing_domain"} checked{/if} />{$EDLANG.UseaDomainIhaveAlreadyPurchased}
+        </label>
+        <div class="domain-input-group clearfix" id="domainexisting_domain">
+            <div class="row">
+                <div class="col-sm-9">
+                    <div class="row domains-row">
+                        <div class="col-xs-2 text-right">
+                            <p class="form-control-static">www.</p>
+                        </div>
+                        <div class="col-xs-7">
+                            <select id="existing_domainsld" name="existing_domaindomain" class="form-control">
+                                {foreach key=num item=existingdomain from=$existingdomains}
+                                    <option value="{$existingdomain}">{$existingdomain}</option>
+                                {/foreach}
+                            </select>                                           
+                        </div>
+                    </div>
+                </div>
+                <div class="col-sm-2">
+                    <button type="submit" id="b_existing_domain" class="btn btn-primary btn-block">
+                        {$LANG.orderForm.use}
+                    </button>
+                </div>
+            </div>
+        </div>
+    </div>
+    {if $WSEXISTING.subdomain}
+    <div class="option">
+        <label>
+            <input type="radio" name="domainoption" value="subexisting_domain" id="selsubexisting_domain"{if $domainoption eq "subexisting_domain"} checked{/if} />{$EDLANG.UseaSubDomainIhaveAlreadyPurchased}
+        </label>
+        <div class="domain-input-group clearfix" id="domainsubexisting_domain">
+            <div class="row">
+                <div class="col-sm-9">
+                    <div class="row domains-row">
+                        <div class="col-xs-2 text-right">
+                            <input name="subdomainexisting_domaindomain" autocapitalize="none" data-toggle="tooltip" data-placement="top" data-trigger="manual" title="{$EDLANG.UseaSubDomainTooltip}" id="subdomainexisting_domaindomains" class="form-control">
+                        </div>
+                        <div class="col-xs-1 text-right" style="padding-right: 0px;padding-left: 0px;width: 2%;">
+                            <p class="form-control-static">.</p>
+                        </div>                                          
+                        <div class="col-xs-6">
+                            <input name="subexisting_domaindomain" type="hidden" value="" id="subexisting_domaindomainid">
+                            <select id="subexisting_domainsld" name="subexisting_domaindomain" class="form-control">
+                                {foreach key=num item=existingdomain from=$existingdomains}
+                                    <option data-oldv="{$existingdomain}" value="{$existingdomain}">{$existingdomain}</option>
+                                {/foreach}
+                            </select>                                           
+                        </div>
+                    </div>
+                </div>
+                <div class="col-sm-2">
+                    <button type="submit" id="b_subexisting_domain" class="btn btn-primary btn-block">
+                        {$LANG.orderForm.use}
+                    </button>
+                </div>
+            </div>
+        </div>
+    </div>
+    {/if}
+    <script>
+        $(document).ready(function () {
+            $("#subdomainexisting_domaindomains").on("keyup", function () {
+                if ($("#subdomainexisting_domaindomains").val() !== '') {
+                    $('#subdomainexisting_domaindomains').tooltip('hide');
+                    var oldvv = $("#subexisting_domainsld").find("option:selected").data("oldv");
+                    $("#subexisting_domaindomainid").val($("#subdomainexisting_domaindomains").val() + '.' + oldvv);
+                } else {
+                    $("#subexisting_domaindomainid").val('');
+                }
+            });
+            {if $WSEXISTING.subdomain}
+            $("#subexisting_domainsld").on("change", function () {
+                if ($("#subdomainexisting_domaindomains").val() !== '') {
+                    var oldvv = $("#subexisting_domainsld").find("option:selected").data("oldv");
+                    $("#subexisting_domaindomainid").val($("#subdomainexisting_domaindomains").val() + '.' + oldvv);
+                } else {
+                    $("#subexisting_domaindomainid").val('');
+                }
+            });
+            {/if}
+        });
+    </script>
+{/if}               

+ 538 - 0
templates/flowcart.tpl

@@ -0,0 +1,538 @@
+{if $existingdomains}
+    <div class="option tab-pane" id="existing_domain">
+        <div class="domain-input-group clearfix" id="domainexisting_domain">
+            <div class="row">
+                <div class="col-sm-9">
+                    <div class="row domains-row">
+                        <div class="col-xs-2 text-right">
+                            <p class="form-control-static">www.</p>
+                        </div>
+                        <div class="col-xs-7">
+                            <select id="existing_domainsld" name="existing_domaindomain" class="form-control">
+                                {foreach key=num item=existingdomain from=$existingdomains}
+                                    <option value="{$existingdomain}">{$existingdomain}</option>
+                                {/foreach}
+                            </select>                                           
+                        </div>
+                    </div>
+                </div>
+                <div class="col-sm-2">
+                    <button type="submit" id="b_existing_domain" class="btn btn-primary btn-block btn-lg">
+                        {$LANG.orderForm.use}
+                    </button>
+                </div>
+            </div>
+        </div>
+    </div>
+    {if $WSEXISTING.subdomain}
+        <div class="option tab-pane" id="subexisting">
+            <div class="domain-input-group clearfix" id="domainsubexisting" >
+                <div class="row">
+                    <div class="col-sm-9">
+                        <div class="row domains-row">
+                            <div class="col-xs-2 text-right">
+                                <input name="subdomainexisting_domaindomain" autocapitalize="none" data-toggle="tooltip" data-placement="top" data-trigger="manual" title="{$EDLANG.UseaSubDomainTooltip}" id="subdomainexisting_domaindomains" class="form-control">
+                            </div>
+                            <div class="col-xs-1 text-right" style="padding-right: 0px;padding-left: 0px;width: 2%;">
+                                <p class="form-control-static">.</p>
+                            </div>                                          
+                            <div class="col-xs-6">
+                                <input name="subexisting_domaindomain" type="hidden" value="" id="subexisting_domaindomainid">
+                                <select id="subexisting_domainsld" name="subexisting_domaindomain" class="form-control">
+                                    {foreach key=num item=existingdomain from=$existingdomains}
+                                        <option data-oldv="{$existingdomain}" value="{$existingdomain}">{$existingdomain}</option>
+                                    {/foreach}
+                                </select>                                           
+                            </div>
+                        </div>
+                    </div>
+                    <div class="col-sm-2">
+                        <button type="submit" id="b_subexisting_domain" class="btn btn-submf btn-primary btn-block">
+                            {$LANG.orderForm.use}
+                        </button>
+                    </div>
+                </div>
+            </div>
+        {/if}
+    </div>
+    {literal}
+        <script type="text/javascript">
+            jQuery('#frmProductDomain').submit(function (e) {
+                e.preventDefault();
+
+                var btnSearchObj = jQuery(this).find('button[type="submit"]'),
+                        domainSearchResults = jQuery("#DomainSearchResults"),
+                        spotlightTlds = jQuery('#spotlightTlds'),
+                        suggestions = jQuery('#domainSuggestions'),
+                        btnDomainContinue = jQuery('#btnDomainContinue'),
+                        domainoption = jQuery(".domain-tabs .active input").val(),
+                        sldInput = jQuery("#" + domainoption + "sld"),
+                        sld = sldInput.val(),
+                        tld = '',
+                        pid = jQuery('#frmProductDomainPid').val(),
+                        tldInput = '';
+
+                if (domainoption == 'incart') {
+                    sldInput = jQuery("#" + domainoption + "sld option:selected");
+                    sld = sldInput.text();
+                } else if (domainoption == 'subdomain') {
+                    tldInput = jQuery("#" + domainoption + "tld option:selected");
+                    tld = tldInput.text();
+                } else if (domainoption == 'subexisting' || domainoption == 'subexisting_domain' || domainoption == 'existing_domain') {
+                    if (domainoption == 'subexisting_domain') {
+                        sld = jQuery("#subexisting_domaindomainid").val();
+                    } else {
+                        sldInput = jQuery("#" + domainoption + "sld option:selected");
+                        sld = sldInput.text();
+                    }
+                } else {
+                    tldInput = jQuery("#" + domainoption + "tld");
+                    tld = tldInput.val();
+                    if (sld && !tld) {
+                        tldInput.tooltip('show');
+                        tldInput.focus();
+                        return false;
+                    }
+                    if (tld.substr(0, 1) != '.') {
+                        tld = '.' + tld;
+                    }
+                }
+                if (!sld) {
+                    sldInput.tooltip('show');
+                    sldInput.focus();
+                    return false;
+                }
+
+                sldInput.tooltip('hide');
+                if (tldInput.length) {
+                    tldInput.tooltip('hide');
+                }
+
+                jQuery('input[name="domainoption"]').iCheck('disable');
+                domainLookupCallCount = 0;
+                btnSearchObj.attr('disabled', 'disabled').addClass('disabled');
+
+                jQuery('.domain-lookup-result').addClass('hidden');
+                jQuery('#primaryLookupResult div').hide();
+                jQuery('#primaryLookupResult').find('.register-price-label').show().end()
+                        .find('.transfer-price-label').addClass('hidden');
+
+                jQuery('.domain-lookup-register-loader').hide();
+                jQuery('.domain-lookup-transfer-loader').hide();
+                jQuery('.domain-lookup-other-loader').hide();
+                if (domainoption == 'register') {
+                    jQuery('.domain-lookup-register-loader').show();
+                } else if (domainoption == 'transfer') {
+                    jQuery('.domain-lookup-transfer-loader').show();
+                } else {
+                    jQuery('.domain-lookup-other-loader').show();
+                }
+
+                jQuery('.domain-lookup-loader').show();
+                suggestions.find('li').addClass('hidden').end()
+                        .find('.clone').remove().end();
+                jQuery('div.panel-footer.more-suggestions').addClass('hidden')
+                        .find('a').removeClass('hidden').end()
+                        .find('span.no-more').addClass('hidden');
+                jQuery('.btn-add-to-cart').removeAttr('disabled')
+                        .find('span').hide().end()
+                        .find('span.to-add').show();
+                btnDomainContinue.addClass('hidden').attr('disabled', 'disabled');
+
+                if (domainoption != 'register') {
+                    spotlightTlds.hide();
+                    jQuery('.suggested-domains').hide();
+                }
+
+                if (!domainSearchResults.is(":visible")) {
+                    domainSearchResults.hide().removeClass('hidden').fadeIn();
+                }
+
+                if (domainoption == 'register') {
+                    jQuery('.suggested-domains').hide().removeClass('hidden').fadeIn('fast');
+                    spotlightTlds.hide().removeClass('hidden').fadeIn('fast');
+                    jQuery('#resultDomainOption').val(domainoption);
+                    var lookup = jQuery.post(
+                            WHMCS.utils.getRouteUrl('/domain/check'),
+                            {
+                                token: csrfToken,
+                                type: 'domain',
+                                domain: sld + tld
+                            },
+                            'json'
+                            ),
+                            spotlight = jQuery.post(
+                                    WHMCS.utils.getRouteUrl('/domain/check'),
+                                    {
+                                        token: csrfToken,
+                                        type: 'spotlight',
+                                        domain: sld + tld
+                                    },
+                                    'json'
+                                    ),
+                            suggestion = jQuery.post(
+                                    WHMCS.utils.getRouteUrl('/domain/check'),
+                                    {
+                                        token: csrfToken,
+                                        type: 'suggestions',
+                                        domain: sld + tld
+                                    },
+                                    'json'
+                                    );
+
+                    // primary lookup handler
+                    lookup.done(function (data) {
+                        jQuery.each(data.result, function (index, domain) {
+                            var pricing = null,
+                                    result = jQuery('#primaryLookupResult'),
+                                    available = result.find('.domain-available'),
+                                    availablePrice = result.find('.domain-price'),
+                                    unavailable = result.find('.domain-unavailable'),
+                                    invalid = result.find('.domain-invalid'),
+                                    contactSupport = result.find('.domain-contact-support'),
+                                    resultDomain = jQuery('#resultDomain'),
+                                    resultDomainPricing = jQuery('#resultDomainPricingTerm');
+                            result.removeClass('hidden').show();
+                            jQuery('.domain-lookup-primary-loader').hide();
+                            if (!data.result.error && domain.isValidDomain) {
+                                pricing = domain.pricing;
+                                if (domain.isAvailable && typeof pricing !== 'string') {
+                                    if (domain.preferredTLDNotAvailable) {
+                                        unavailable.show().find('strong').html(domain.originalUnavailableDomain);
+                                    }
+                                    contactSupport.hide();
+                                    available.show().find('strong').html(domain.domainName);
+                                    availablePrice.show().find('span.price').html(pricing[Object.keys(pricing)[0]].register).end()
+                                            .find('button').attr('data-domain', domain.idnDomainName);
+                                    resultDomain.val(domain.domainName);
+                                    resultDomainPricing.val(Object.keys(pricing)[0]).attr('name', 'domainsregperiod[' + domain.domainName + ']');
+
+                                    btnDomainContinue.removeAttr('disabled');
+                                } else {
+                                    unavailable.show().find('strong').html(domain.domainName);
+                                    contactSupport.hide();
+                                    if (typeof pricing === 'string' && pricing == 'ContactUs') {
+                                        contactSupport.show();
+                                    }
+                                }
+                            } else {
+                                var invalidLength = invalid.find('span.domain-length-restrictions');
+                                invalidLength.hide();
+                                if (domain.minLength > 0 && domain.maxLength > 0) {
+                                    invalidLength.find('.min-length').html(domain.minLength).end()
+                                            .find('.max-length').html(domain.maxLength).end();
+                                    invalidLength.show();
+                                }
+                                invalid.show();
+                            }
+
+
+                        });
+                    }).always(function () {
+                        hasProductDomainLookupEnded(3, btnSearchObj);
+                    });
+
+                    // spotlight lookup handler
+                    spotlight.done(function (data) {
+                        if (typeof data != 'object' || data.result.length == 0 || data.result.error) {
+                            jQuery('.domain-lookup-spotlight-loader').hide();
+                            return;
+                        }
+                        jQuery.each(data.result, function (index, domain) {
+                            var tld = domain.tldNoDots,
+                                    pricing = domain.pricing,
+                                    result = jQuery('#spotlight' + tld + ' .domain-lookup-result');
+                            jQuery('.domain-lookup-spotlight-loader').hide();
+                            result.find('button').addClass('hidden').end();
+                            if (domain.isValidDomain) {
+                                if (domain.isAvailable && typeof pricing !== 'string') {
+                                    result
+                                            .find('span.available').html(pricing[Object.keys(pricing)[0]].register).removeClass('hidden').end()
+                                            .find('button.btn-add-to-cart')
+                                            .attr('data-domain', domain.idnDomainName)
+                                            .removeClass('hidden');
+                                } else {
+                                    if (typeof pricing === 'string') {
+                                        if (pricing == '') {
+                                            result.find('button.unavailable').removeClass('hidden').end();
+                                        } else {
+                                            result.find('button.domain-contact-support').removeClass('hidden').end();
+                                        }
+                                        result.find('span.available').addClass('hidden').end();
+                                    } else {
+                                        result.find('button.unavailable').removeClass('hidden').end();
+                                        result.find('span.available').addClass('hidden').end();
+                                    }
+                                }
+                            } else {
+                                result.find('button.invalid.hidden').removeClass('hidden').end()
+                                        .find('span.available').addClass('hidden').end()
+                                        .find('button').not('button.invalid').addClass('hidden');
+                            }
+                            result.removeClass('hidden');
+                        });
+                    }).always(function () {
+                        hasProductDomainLookupEnded(3, btnSearchObj);
+                    });
+
+                    // suggestions lookup handler
+                    suggestion.done(function (data) {
+                        if (typeof data != 'object' || data.result.length == 0 || data.result.error) {
+                            jQuery('.suggested-domains').fadeOut('fast', function () {
+                                jQuery(this).addClass('hidden');
+                            });
+                            return;
+                        } else {
+                            jQuery('.suggested-domains').removeClass('hidden');
+                        }
+                        var suggestionCount = 1;
+                        jQuery.each(data.result, function (index, domain) {
+                            var tld = domain.tld,
+                                    pricing = domain.pricing;
+                            suggestions.find('li:first').clone(true, true).appendTo(suggestions);
+                            var newSuggestion = suggestions.find('li.domain-suggestion').last();
+                            newSuggestion.addClass('clone')
+                                    .find('span.domain').html(domain.sld).end()
+                                    .find('span.extension').html('.' + tld).end();
+
+                            if (typeof pricing === 'string') {
+                                newSuggestion.find('button.btn-add-to-cart').remove();
+                                if (pricing != '') {
+                                    newSuggestion.find('button.domain-contact-support').removeClass('hidden').end()
+                                            .find('span.price').hide();
+                                } else {
+                                    newSuggestion.remove();
+                                }
+                            } else {
+                                newSuggestion.find('button.btn-add-to-cart').attr('data-domain', domain.idnDomainName).end()
+                                        .find('span.price').html(pricing[Object.keys(pricing)[0]].register).end();
+                            }
+
+                            if (suggestionCount <= 10) {
+                                newSuggestion.removeClass('hidden');
+                            }
+                            suggestionCount++;
+                            if (domain.group) {
+                                newSuggestion.find('span.promo')
+                                        .addClass(domain.group)
+                                        .html(domain.group.toUpperCase())
+                                        .removeClass('hidden')
+                                        .end();
+                            }
+                            furtherSuggestions = suggestions.find('li.domain-suggestion.clone.hidden').length;
+                            if (furtherSuggestions > 0) {
+                                jQuery('div.more-suggestions').removeClass('hidden');
+                            }
+                        });
+                        jQuery('.domain-lookup-suggestions-loader').hide();
+                        jQuery('#domainSuggestions').removeClass('hidden');
+                    }).always(function () {
+                        hasProductDomainLookupEnded(3, btnSearchObj);
+                    });
+                } else if (domainoption == 'transfer') {
+                    jQuery('#resultDomainOption').val(domainoption);
+                    var transfer = jQuery.post(
+                            WHMCS.utils.getRouteUrl('/domain/check'),
+                            {
+                                token: csrfToken,
+                                type: 'transfer',
+                                domain: sld + tld
+                            },
+                            'json'
+                            );
+
+                    transfer.done(function (data) {
+                        if (typeof data != 'object' || data.result.length == 0) {
+                            jQuery('.domain-lookup-primary-loader').hide();
+                            return;
+                        }
+                        var result = jQuery('#primaryLookupResult'),
+                                transfereligible = result.find('.transfer-eligible'),
+                                transferPrice = result.find('.domain-price'),
+                                transfernoteligible = result.find('.transfer-not-eligible'),
+                                resultDomain = jQuery('#resultDomain'),
+                                resultDomainPricing = jQuery('#resultDomainPricingTerm');
+                        if (Object.keys(data.result).length === 0) {
+                            jQuery('.domain-lookup-primary-loader').hide();
+                            result.removeClass('hidden').show();
+                            transfernoteligible.show();
+                        }
+                        jQuery.each(data.result, function (index, domain) {
+                            var pricing = domain.pricing;
+                            jQuery('.domain-lookup-primary-loader').hide();
+                            result.removeClass('hidden').show();
+                            if (domain.isRegistered) {
+                                transfereligible.show();
+                                transferPrice.show().find('.register-price-label').hide().end()
+                                        .find('.transfer-price-label').removeClass('hidden').show().end()
+                                        .find('span.price').html(pricing[Object.keys(pricing)[0]].transfer).end()
+                                        .find('button').attr('data-domain', domain.idnDomainName);
+                                resultDomain.val(domain.domainName);
+                                resultDomainPricing.val(Object.keys(pricing)[0]).attr('name', 'domainsregperiod[' + domain.domainName + ']');
+                                btnDomainContinue.removeAttr('disabled');
+                            } else {
+                                transfernoteligible.show();
+                            }
+                        });
+                    }).always(function () {
+                        hasProductDomainLookupEnded(1, btnSearchObj);
+                    });
+                } else if (domainoption == 'owndomain' || domainoption == 'subdomain' || domainoption == 'incart') {
+
+                    var otherDomain = jQuery.post(
+                            WHMCS.utils.getRouteUrl('/domain/check'),
+                            {
+                                token: csrfToken,
+                                type: domainoption,
+                                pid: pid,
+                                domain: sld + tld
+                            },
+                            'json'
+                            );
+
+                    otherDomain.done(function (data) {
+                        if (typeof data != 'object' || data.result.length == 0) {
+                            jQuery('.domain-lookup-subdomain-loader').hide();
+                            return;
+                        }                       
+                        jQuery.each(data.result, function (index, result) {
+                            if (result.status === true) {
+                                window.location = 'cart.php?a=confproduct&i=' + result.num;
+                            } else {
+                                jQuery('.domain-lookup-primary-loader').hide();
+                                jQuery('#primaryLookupResult').removeClass('hidden').show().find('.domain-invalid').show();
+                            }
+                        });
+
+                    }).always(function () {
+                        hasProductDomainLookupEnded(1, btnSearchObj);
+                    });
+                } else if (domainoption === 'existing_domain') {
+
+                    sldInput = jQuery("#existing_domainsld option:selected");
+                    sld = sldInput.text();
+                    var splitDomain = sld.split('.');
+                    sld = splitDomain[0];
+                    splitDomain.splice(0, 1);
+                    tld = '.' + splitDomain.join(".");
+
+                    jQuery('.domain-lookup-other-loader').show();
+                    jQuery('.domain-lookup-loader').show();
+
+                    btnDomainContinue.addClass('hidden').attr('disabled', 'disabled');
+
+                    var otherDomain = jQuery.post(
+                            'cart.php',
+                            {
+                                token: csrfToken,
+                                a: 'checkDomain',
+                                type: "owndomain", //domainoption,
+                                pid: pid,
+                                wscheck: 1,                                                                
+                                domain: sld + tld
+                            },
+                            'json'
+                            );
+
+                    otherDomain.done(function (data) {
+                        if (typeof data !== 'object' || data.result.length === 0) {
+                            jQuery('.domain-lookup-subdomain-loader').hide();
+                            return;
+                        }   
+                        if (typeof data.result.wsres !== 'undefined' && data.result.wsres.length > 0) {
+                            $(".errordomainnamepws").remove();
+                            {/literal}
+                            $('#frmProductDomainSelections').prepend('<div class="errordomainnamepws alert alert-danger"><strong>' + data.result.wsdomain + '</strong> {$EDLANG.errordomain}</div>');
+                            {literal}
+                        }                         
+                        jQuery.each(data.result, function (index, result) {
+                            if (result.status === true) {
+                                window.location = 'cart.php?a=confproduct&i=' + result.num;
+                            } else {
+                                jQuery('.domain-lookup-primary-loader').hide();
+                                jQuery('#primaryLookupResult').removeClass('hidden').show().find('.domain-invalid').show();
+                            }
+                        });
+
+                    }).always(function () {
+                        hasProductDomainLookupEnded(1, btnSearchObj);
+                    });
+                } else if (domainoption === 'subexisting_domain') {
+                    if ($("#subdomainexisting_domaindomains").val() === '') {
+                        $('#subdomainexisting_domaindomains').tooltip('show');
+                        return 0;
+                    }
+                    jQuery('.domain-lookup-other-loader').show();
+                    jQuery('.domain-lookup-loader').show();
+
+                    btnDomainContinue.addClass('hidden').attr('disabled', 'disabled');
+                    var ddsubdomain = $("#subexisting_domaindomainid").val();
+                    var otherDomain = jQuery.post(
+                            'cart.php',
+                            {
+                                token: csrfToken,
+                                a: 'checkDomain',
+                                type: "owndomain", //domainoption,
+                                pid: pid,
+                                wscheck: 1,                                                                                                
+                                domain: ddsubdomain
+                            },
+                            'json'
+                            );
+
+                    otherDomain.done(function (data) {
+                        if (typeof data !== 'object' || data.result.length === 0) {
+                            jQuery('.domain-lookup-subdomain-loader').hide();
+                            return;
+                        }
+                        if (typeof data.result.wsres !== 'undefined' && data.result.wsres.length > 0) {
+                            $(".errordomainnamepws").remove();
+                            {/literal}
+                            $('#frmProductDomainSelections').prepend('<div class="errordomainnamepws alert alert-danger"><strong>' + data.result.wsdomain + '</strong> {$EDLANG.errordomain}</div>');
+                            {literal}
+                        }                            
+                        jQuery.each(data.result, function (index, result) {
+                            if (result.status === true) {
+                                window.location = 'cart.php?a=confproduct&i=' + result.num;
+                            } else {
+                                jQuery('.domain-lookup-primary-loader').hide();
+                                jQuery('#primaryLookupResult').removeClass('hidden').show().find('.domain-invalid').show();
+                            }
+                        });
+
+                    }).always(function () {
+                        hasProductDomainLookupEnded(1, btnSearchObj);
+                    });
+                }
+
+
+                btnDomainContinue.removeClass('hidden');
+            });
+
+        </script>        
+        <script>
+            $(document).ready(function () {
+                $("#subdomainexisting_domaindomains").on("keyup", function () {
+                    if ($("#subdomainexisting_domaindomains").val() !== '') {
+                        $('#subdomainexisting_domaindomains').tooltip('hide');
+                        var oldvv = $("#subexisting_domainsld").find("option:selected").data("oldv");
+                        $("#subexisting_domaindomainid").val($("#subdomainexisting_domaindomains").val() + '.' + oldvv);
+                    } else {
+                        $("#subexisting_domaindomainid").val('');
+                    }
+                });
+                $(".btn-submf").on("click", function () {
+                    jQuery('#frmProductDomain').submit();
+                });
+                $("#subexisting_domainsld").on("change", function () {
+                    if ($("#subdomainexisting_domaindomains").val() !== '') {
+                        var oldvv = $("#subexisting_domainsld").find("option:selected").data("oldv");
+                        $("#subexisting_domaindomainid").val($("#subdomainexisting_domaindomains").val() + '.' + oldvv);
+                    } else {
+                        $("#subexisting_domaindomainid").val('');
+                    }
+                });
+            });
+        </script>
+    {/literal}
+{/if}               

+ 3 - 0
templates/index.php

@@ -0,0 +1,3 @@
+
+<p align="center"><b>WS Existing Domain for WHMCS</b></p>
+

+ 10 - 0
templates/lagom-header.tpl

@@ -0,0 +1,10 @@
+{if $existingdomains}
+	<label class="radio">
+		<input type="radio" class="icheck-control" name="domainoption" value="existing_domain" id="selexisting_domain"{if $domainoption eq "existing_domain"} checked{/if} />{$EDLANG.UseaDomainIhaveAlreadyPurchased}
+	</label>
+	{if $WSEXISTING.subdomain}
+		<label class="radio">
+			<input type="radio" class="icheck-control" name="domainoption" value="subexisting_domain" id="selsubexisting_domain"{if $domainoption eq "subexisting_domain"} checked{/if} />{$EDLANG.UseaSubDomainIhaveAlreadyPurchased}
+		</label>
+	{/if}
+{/if}

+ 460 - 0
templates/lagom.tpl

@@ -0,0 +1,460 @@
+{if $existingdomains}
+    <div class="inline-form hidden" id="domainexisting_domain">
+        <div class="col-md-12">
+            <div class="col-sm-9">
+                <div class="row domains-row">
+                    <div class="col-xs-3 text-right">
+                        <p class="form-control-static" style="color:#FFF">www.</p>
+                    </div>
+                    <div class="col-xs-9">
+                        <select id="existing_domainsld" name="existing_domaindomain" class="form-control">
+                            {foreach key=num item=existingdomain from=$existingdomains}
+                                <option value="{$existingdomain}">{$existingdomain}</option>
+                            {/foreach}
+                        </select>                                           
+                    </div>
+                </div>
+            </div>
+            <div class="col-sm-2">
+                <button type="submit" id="b_existing_domain" class="btn btn-primary btn-block btn-lg">
+                    {$LANG.orderForm.use}
+                </button>
+            </div>
+        </div>
+    </div>
+    {if $WSEXISTING.subdomain}
+        <div class="inline-form hidden" id="domainsubexisting_domain" >
+            <div class="col-md-12">
+                <div class="col-sm-9">
+                    <div class="row domains-row">
+                        <div class="col-xs-2 text-right">
+                            <input name="subdomainexisting_domaindomain" autocapitalize="none" data-toggle="tooltip" data-placement="top" data-trigger="manual" title="{$EDLANG.UseaSubDomainTooltip}" id="subdomainexisting_domaindomains" class="form-control">
+                        </div>
+                        <div class="col-xs-1 text-right" style="padding-right: 0px;padding-left: 0px;width: 2%;">
+                            <p class="form-control-static" style="color:#FFF">.</p>
+                        </div>                                          
+                        <div class="col-xs-9">
+                            <input name="subexisting_domaindomain" type="hidden" value="" id="subexisting_domaindomainid">
+                            <select id="subexisting_domainsld" name="subexisting_domaindomain" class="form-control">
+                                {foreach key=num item=existingdomain from=$existingdomains}
+                                    <option data-oldv="{$existingdomain}" value="{$existingdomain}">{$existingdomain}</option>
+                                {/foreach}
+                            </select>                                           
+                        </div>
+                    </div>
+                </div>
+                <div class="col-sm-2">
+                    <button type="submit" id="b_subexisting_domain" class="btn btn-submf btn-primary btn-block">
+                        {$LANG.orderForm.use}
+                    </button>
+                </div>
+            </div>
+        </div> 
+    {/if}
+{/if}
+{literal}
+    <script>
+        $(document).ready(function () {
+            $("#subdomainexisting_domaindomains").on("keyup", function () {
+                if ($("#subdomainexisting_domaindomains").val() !== '') {
+                    $('#subdomainexisting_domaindomains').tooltip('hide');
+                    var oldvv = $("#subexisting_domainsld").find("option:selected").data("oldv");
+                    $("#subexisting_domaindomainid").val($("#subdomainexisting_domaindomains").val() + '.' + oldvv);
+                } else {
+                    $("#subexisting_domaindomainid").val('');
+                }
+            });
+            $(".btn-submf").on("click", function () {
+                jQuery('#frmProductDomain').submit();
+            });
+            $("#subexisting_domainsld").on("change", function () {
+                if ($("#subdomainexisting_domaindomains").val() !== '') {
+                    var oldvv = $("#subexisting_domainsld").find("option:selected").data("oldv");
+                    $("#subexisting_domaindomainid").val($("#subdomainexisting_domaindomains").val() + '.' + oldvv);
+                } else {
+                    $("#subexisting_domaindomainid").val('');
+                }
+            });
+        });
+    </script>    
+    <script>
+        jQuery(document).ready(function () {
+            jQuery('#frmProductDomain').submit(function (e) {
+                e.preventDefault();
+                var btnSearchObj = jQuery(this).find('button[type="submit"]'),
+                        domainSearchResults = jQuery("#DomainSearchResults"),
+                        spotlightTlds = jQuery('#spotlightTlds'),
+                        suggestions = jQuery('#domainSuggestions'),
+                        btnDomainContinue = jQuery('#btnDomainContinue'),
+                        domainoption = jQuery(".panel-domain-option input:checked").val(),
+                        sldInput = jQuery("#" + domainoption + "sld"),
+                        sld = sldInput.val(),
+                        tld = '',
+                        pid = jQuery('#frmProductDomainPid').val(),
+                        tldInput = '';
+
+                if (domainoption == 'incart') {
+                    sldInput = jQuery("#" + domainoption + "sld option:selected");
+                    sld = sldInput.text();
+                } else if (domainoption == 'subexisting' || domainoption == 'subexisting_domain' || domainoption == 'existing_domain') {
+                    if (domainoption == 'subexisting_domain') {
+                        sld = jQuery("#subexisting_domaindomainid").val();
+                    } else {
+                        sldInput = jQuery("#" + domainoption + "sld option:selected");
+                        sld = sldInput.text();
+                    }
+                } else if (domainoption == 'subdomain') {
+                    tldInput = jQuery("#" + domainoption + "tld option:selected");
+                    tld = tldInput.text();
+                } else {
+                    tldInput = jQuery("#" + domainoption + "tld");
+                    tld = tldInput.val();
+                    if (sld && !tld) {
+                        tldInput.tooltip('show');
+                        tldInput.focus();
+                        return false;
+                    }
+                    if (tld.substr(0, 1) != '.') {
+                        tld = '.' + tld;
+                    }
+                }
+                if (!sld) {
+                    sldInput.tooltip('show');
+                    sldInput.focus();
+                    return false;
+                }
+                sldInput.tooltip('hide');
+                if (tldInput.length) {
+                    tldInput.tooltip('hide');
+                }
+                jQuery('input[name="domainoption"]').iCheck('disable');
+                domainLookupCallCount = 0;
+                btnSearchObj.attr('disabled', 'disabled').addClass('disabled');
+                jQuery('.domain-lookup-loader').removeClass('hidden');
+                jQuery("html, body").animate({scrollTop: $('.domain-lookup-loader').offset().top - 150}, 500);
+                jQuery('#DomainSearchResults').addClass('hidden');
+                jQuery('#primaryLookupResult > div').hide();
+                suggestions.find('li').addClass('hidden').end()
+                        .find('.clone').remove().end();
+                jQuery('div.panel-footer.more-suggestions').addClass('hidden')
+                        .find('a').removeClass('hidden').end()
+                        .find('span.no-more').addClass('hidden');
+                jQuery('.btn-add-to-cart').removeAttr('disabled')
+                        .find('span').hide().end()
+                        .find('span.to-add').show();
+                btnDomainContinue.addClass('hidden').attr('disabled', 'disabled');
+                if (domainoption != 'register') {
+                    spotlightTlds.hide();
+                    jQuery('.suggested-domains').hide();
+                }
+                // if (!domainSearchResults.is(":visible")) {
+                //     domainSearchResults.removeClass('hidden');
+                // }
+
+                if (domainoption == 'register') {
+                    // jQuery('#DomainSearchResults').addClass('hidden');
+                    jQuery('#resultDomainOption').val(domainoption);
+                    var lookup = jQuery.post(
+                            WHMCS.utils.getRouteUrl('/domain/check'),
+                            {
+                                token: csrfToken,
+                                type: 'domain',
+                                domain: sld + tld
+                            },
+                            'json'
+                            ),
+                            spotlight = jQuery.post(
+                                    WHMCS.utils.getRouteUrl('/domain/check'),
+                                    {
+                                        token: csrfToken,
+                                        type: 'spotlight',
+                                        domain: sld + tld
+                                    },
+                                    'json'
+                                    ),
+                            suggestion = jQuery.post(
+                                    WHMCS.utils.getRouteUrl('/domain/check'),
+                                    {
+                                        token: csrfToken,
+                                        type: 'suggestions',
+                                        domain: sld + tld
+                                    },
+                                    'json'
+                                    );
+                    // primary lookup handler
+                    lookup.done(function (data) {
+                        jQuery.each(data.result, function (index, domain) {
+                            var pricing = null,
+                                    result = jQuery('#primaryLookupResult'),
+                                    available = result.find('.domain-available'),
+                                    availablePrice = result.find('.domain-price'),
+                                    unavailable = result.find('.domain-unavailable'),
+                                    invalid = result.find('.domain-invalid'),
+                                    contactSupport = result.find('.domain-contact-support'),
+                                    resultDomain = jQuery('#resultDomain'),
+                                    resultDomainPricing = jQuery('#resultDomainPricingTerm');
+                            result.removeClass('hidden').show();
+                            if (!data.result.error && domain.isValidDomain) {
+                                pricing = domain.pricing;
+                                if (domain.isAvailable && typeof pricing !== 'string') {
+                                    if (domain.preferredTLDNotAvailable) {
+                                        unavailable.show().find('strong').html(domain.originalUnavailableDomain);
+                                    }
+                                    contactSupport.hide();
+                                    available.show().find('strong').html(domain.domainName);
+                                    availablePrice.show().find('.price').html(pricing[Object.keys(pricing)[0]].register).end()
+                                            .find('button').attr('data-domain', domain.idnDomainName);
+                                    resultDomain.val(domain.domainName);
+                                    resultDomainPricing.val(Object.keys(pricing)[0]).attr('name', 'domainsregperiod[' + domain.domainName + ']');
+                                    btnDomainContinue.removeAttr('disabled');
+                                    $('body').addClass('is-actions');
+                                    //var counterDomain =  parseInt(jQuery('#cartItemCount').text()),
+                                    //domainNumber = counterDomain + 1;
+                                    //jQuery('#cartItemCount').html(domainNumber).addClass('badge--primary');
+
+                                } else {
+                                    unavailable.show().find('strong').html(domain.domainName);
+                                    contactSupport.hide();
+                                    if (typeof pricing === 'string' && pricing == 'ContactUs') {
+                                        contactSupport.show();
+                                    }
+                                }
+                            } else {
+                                var invalidLength = invalid.find('span.domain-length-restrictions');
+                                invalidLength.hide();
+                                if (domain.minLength > 0 && domain.maxLength > 0) {
+                                    invalidLength.find('.min-length').html(domain.minLength).end()
+                                            .find('.max-length').html(domain.maxLength).end();
+                                    invalidLength.show();
+                                }
+                                invalid.show();
+                            }
+                        });
+                    }).always(function () {
+                        hasProductDomainLookupEnded(3, btnSearchObj);
+                    });
+                    // spotlight lookup handler
+                    spotlight.done(function (data) {
+                        if (typeof data != 'object' || data.result.length == 0 || data.result.error) {
+                            jQuery('.domain-lookup-spotlight-loader').hide();
+                            return;
+                        }
+                        jQuery.each(data.result, function (index, domain) {
+                            var tld = domain.tldNoDots,
+                                    pricing = domain.pricing,
+                                    result = jQuery('#spotlight' + tld + ' .domain-lookup-result');
+                            jQuery('.domain-lookup-spotlight-loader').hide();
+                            result.find('button').addClass('hidden').end();
+                            if (domain.isValidDomain) {
+                                if (domain.isAvailable && typeof pricing !== 'string') {
+                                    result
+                                            .find('span.available').html(pricing[Object.keys(pricing)[0]].register).removeClass('hidden').end()
+                                            .find('button.btn-add-to-cart')
+                                            .attr('data-domain', domain.idnDomainName)
+                                            .removeClass('hidden');
+                                } else {
+                                    if (typeof pricing === 'string') {
+                                        if (pricing == '') {
+                                            result.find('button.unavailable').removeClass('hidden').end();
+                                        } else {
+                                            result.find('button.domain-contact-support').removeClass('hidden').end();
+                                        }
+                                        result.find('span.available').addClass('hidden').end();
+                                    } else {
+                                        result.find('button.unavailable').removeClass('hidden').end();
+                                        result.find('span.available').addClass('hidden').end();
+                                    }
+                                }
+                            } else {
+                                result.find('button.invalid.hidden').removeClass('hidden').end()
+                                        .find('span.available').addClass('hidden').end()
+                                        .find('button').not('button.invalid').addClass('hidden');
+                            }
+                            result.removeClass('hidden');
+                        });
+                    }).always(function () {
+                        hasProductDomainLookupEnded(3, btnSearchObj);
+                    });
+                    // suggestions lookup handler
+                    suggestion.done(function (data) {
+                        if (typeof data != 'object' || data.result.length == 0 || data.result.error) {
+                            jQuery('.suggested-domains').fadeOut('fast', function () {
+                                jQuery(this).addClass('hidden');
+                            });
+                            return;
+                        } else {
+                            jQuery('.suggested-domains').removeClass('hidden');
+                        }
+                        var suggestionCount = 1;
+                        jQuery.each(data.result, function (index, domain) {
+                            var tld = domain.tld,
+                                    pricing = domain.pricing;
+                            suggestions.find('li:first').clone(true, true).appendTo(suggestions);
+                            var newSuggestion = suggestions.find('li.domain-suggestion').last();
+                            newSuggestion.addClass('clone')
+                                    .find('span.domain').html(domain.sld).end()
+                                    .find('span.extension').html('.' + tld).end();
+                            if (typeof pricing === 'string') {
+                                newSuggestion.find('button.btn-add-to-cart').remove();
+                                if (pricing != '') {
+                                    newSuggestion.find('button.domain-contact-support').removeClass('hidden').end()
+                                            .find('span.price').hide();
+                                } else {
+                                    newSuggestion.remove();
+                                }
+                            } else {
+                                newSuggestion.find('button.btn-add-to-cart').attr('data-domain', domain.idnDomainName).end()
+                                        .find('span.price').html(pricing[Object.keys(pricing)[0]].register).end();
+                            }
+                            if (suggestionCount <= 10) {
+                                newSuggestion.removeClass('hidden');
+                            }
+                            suggestionCount++;
+                            if (domain.group) {
+                                newSuggestion.find('span.promo')
+                                        .addClass(domain.group)
+                                        .removeClass('hidden')
+                                        .end();
+                                newSuggestion.find('span.sales-group-' + domain.group)
+                                        .removeClass('hidden')
+                                        .end();
+                            }
+                            furtherSuggestions = suggestions.find('li.domain-suggestion.clone.hidden').length;
+                            if (furtherSuggestions > 0) {
+                                jQuery('div.more-suggestions').removeClass('hidden');
+                            }
+                        });
+                        jQuery('.domain-lookup-suggestions-loader').hide();
+                        jQuery('#domainSuggestions').removeClass('hidden');
+                    }).always(function () {
+                        hasProductDomainLookupEnded(3, btnSearchObj);
+                        jQuery('.domain-lookup-loader').addClass('hidden');
+                        jQuery('#DomainSearchResults').removeClass('hidden');
+                    });
+                } else if (domainoption == 'transfer') {
+                    jQuery('#resultDomainOption').val(domainoption);
+                    var transfer = jQuery.post(
+                            WHMCS.utils.getRouteUrl('/domain/check'),
+                            {
+                                token: csrfToken,
+                                type: 'transfer',
+                                domain: sld + tld
+                            },
+                            'json'
+                            );
+                    transfer.done(function (data) {
+                        if (typeof data != 'object' || data.result.length == 0) {
+                            jQuery('.domain-lookup-loader').addClass('hidden');
+                            return;
+                        }
+                        var result = jQuery('#primaryLookupResult'),
+                                transfereligible = result.find('.transfer-eligible'),
+                                transferPrice = result.find('.domain-price'),
+                                transfernoteligible = result.find('.transfer-not-eligible'),
+                                resultDomain = jQuery('#resultDomain'),
+                                resultDomainPricing = jQuery('#resultDomainPricingTerm');
+                        if (Object.keys(data.result).length === 0) {
+                            jQuery('.domain-lookup-loader').addClass('hidden');
+                            result.removeClass('hidden').show();
+                            transfernoteligible.show();
+                        }
+                        jQuery.each(data.result, function (index, domain) {
+                            var pricing = domain.pricing;
+                            jQuery('.domain-lookup-loader').addClass('hidden');
+                            result.removeClass('hidden').show();
+                            if (domain.isRegistered) {
+                                transfereligible.show();
+                                transferPrice.show().find('.register-price-label').hide().end()
+                                        .find('.transfer-price-label').removeClass('hidden').show().end()
+                                        .find('.price').html(pricing[Object.keys(pricing)[0]].transfer).end()
+                                        .find('button').attr('data-domain', domain.idnDomainName);
+                                resultDomain.val(domain.domainName);
+                                resultDomainPricing.val(Object.keys(pricing)[0]).attr('name', 'domainsregperiod[' + domain.domainName + ']');
+                                btnDomainContinue.removeAttr('disabled');
+                            } else {
+                                transfernoteligible.show();
+                            }
+                        });
+                    }).always(function () {
+                        hasProductDomainLookupEnded(1, btnSearchObj);
+                        jQuery('.domain-lookup-loader').addClass('hidden');
+                        jQuery('#DomainSearchResults').removeClass('hidden');
+                    });
+                } else if (domainoption == 'owndomain' || domainoption == 'subdomain' || domainoption == 'incart') {
+                    var otherDomain = jQuery.post(
+                            WHMCS.utils.getRouteUrl('/domain/check'),
+                            {
+                                token: csrfToken,
+                                type: domainoption,
+                                pid: pid,
+                                wscheck: 1,
+                                domain: sld + tld
+                            },
+                            'json'
+                            );
+                    otherDomain.done(function (data) {
+                        if (typeof data != 'object' || data.result.length == 0) {
+                            jQuery('.domain-lookup-subdomain-loader').hide();
+                            return;
+                        }
+                        if (typeof data.result.wsres !== 'undefined' && data.result.wsres.length > 0) {
+                            $(".errordomainnamepws").remove();
+                            {/literal}
+                            $('#DomainSearchResults').prepend('<div class="errordomainnamepws alert alert-danger"><strong>' + data.result.wsdomain + '</strong> {$EDLANG.errordomain}</div>');
+                            {literal}
+                        }
+                        jQuery.each(data.result, function (index, result) {
+                            if (result.status === true) {
+                                window.location = 'cart.php?a=confproduct&i=' + result.num;
+                            } else {
+                                jQuery('.domain-lookup-loader').addClass('hidden');
+                                jQuery('#primaryLookupResult').removeClass('hidden').show().find('.domain-invalid').show();
+                            }
+                        });
+                    }).always(function () {
+                        hasProductDomainLookupEnded(1, btnSearchObj);
+                        jQuery('.domain-lookup-loader').addClass('hidden');
+                        jQuery('#DomainSearchResults').removeClass('hidden');
+                    });
+                } else {
+                    var otherDomain = jQuery.post(
+                            WHMCS.utils.getRouteUrl('/domain/check'),
+                            {
+                                token: csrfToken,
+                                type: 'incart',
+                                pid: pid,
+                                wscheck: 1,                                
+                                domain: sld + tld
+                            },
+                            'json'
+                            );
+                    otherDomain.done(function (data) {
+                        if (typeof data != 'object' || data.result.length == 0) {
+                            jQuery('.domain-lookup-subdomain-loader').hide();
+                            return;
+                        }
+                        if (typeof data.result.wsres !== 'undefined' && data.result.wsres.length > 0) {
+                            $(".errordomainnamepws").remove();
+                            {/literal}
+                            $('#DomainSearchResults').prepend('<div class="errordomainnamepws alert alert-danger"><strong>' + data.result.wsdomain + '</strong> {$EDLANG.errordomain}</div>');
+                            {literal}
+                        }                        
+                        jQuery.each(data.result, function (index, result) {
+                            if (result.status === true) {
+                                window.location = 'cart.php?a=confproduct&i=' + result.num;
+                            } else {
+                                jQuery('.domain-lookup-loader').addClass('hidden');
+                                jQuery('#primaryLookupResult').removeClass('hidden').show().find('.domain-invalid').show();
+                            }
+                        });
+                    }).always(function () {
+                        hasProductDomainLookupEnded(1, btnSearchObj);
+                        jQuery('.domain-lookup-loader').addClass('hidden');
+                        jQuery('#DomainSearchResults').removeClass('hidden');
+                    });
+                }
+                btnDomainContinue.removeClass('hidden');
+            });
+        });
+    </script>
+{/literal}

+ 109 - 0
templates/other.tpl

@@ -0,0 +1,109 @@
+{if $existingdomains}
+    <div class="option">
+        <label class="radio-inline">
+            <input type="radio" name="domainoption" value="existing_domain" id="selexisting_domain"{if $domainoption eq "existing_domain"} checked{/if} />{$EDLANG.UseaDomainIhaveAlreadyPurchased}
+        </label>
+        <div class="domain-input-group domainreginput hidden clearfix" id="domainexisting_domain">
+            <div class="row">
+                <div class="col-sm-9">
+                    <div class="row domains-row">
+                        <div class="col-xs-2 text-right">
+                            <p class="form-control-static">www.</p>
+                        </div>
+                        <div class="col-xs-7">
+                            <select id="existing_domainsld" name="existing_domaindomain" class="form-control">
+                                {foreach key=num item=existingdomain from=$existingdomains}
+                                    <option value="{$existingdomain}">{$existingdomain}</option>
+                                {/foreach}
+                            </select>                                           
+                        </div>
+                    </div>
+                </div>
+                <div class="col-sm-2">
+                    <button type="submit" id="b_existing_domain" class="exd_btn btn btn-primary btn-block">
+                        {$LANG.orderForm.use}
+                    </button>
+                </div>
+            </div>
+        </div>
+    </div>
+    {if $WSEXISTING.subdomain}
+        <div class="option">
+            <label class="radio-inline">
+                <input type="radio" name="domainoption" value="subexisting_domain" id="selsubexisting_domain"{if $domainoption eq "subexisting_domain"} checked{/if} />{$EDLANG.UseaSubDomainIhaveAlreadyPurchased}
+            </label>
+            <div class="domain-input-group domainreginput hidden clearfix" id="domainsubexisting_domain">
+                <div class="row">
+                    <div class="col-sm-9">
+                        <div class="row domains-row">
+                            <div class="col-xs-2 text-right">
+                                <input name="subdomainexisting_domaindomain" autocapitalize="none" data-toggle="tooltip" data-placement="top" data-trigger="manual" title="{$EDLANG.UseaSubDomainTooltip}" id="subdomainexisting_domaindomains" class="form-control">
+                            </div>
+                            <div class="col-xs-1 text-right" style="padding-right: 0px;padding-left: 0px;width: 2%;">
+                                <p class="form-control-static">.</p>
+                            </div>                                          
+                            <div class="col-xs-6">
+                                <input name="subexisting_domaindomain" type="hidden" value="" id="subexisting_domaindomainid">
+                                <select id="subexisting_domainsld" name="subexisting_domaindomain" class="form-control">
+                                    {foreach key=num item=existingdomain from=$existingdomains}
+                                        <option data-oldv="{$existingdomain}" value="{$existingdomain}">{$existingdomain}</option>
+                                    {/foreach}
+                                </select>                                           
+                            </div>
+                        </div>
+                    </div>
+                    <div class="col-sm-2">
+                        <button type="submit" id="b_subexisting_domain" class="exd_btn btn btn-primary btn-block">
+                            {$LANG.orderForm.use}
+                        </button>
+                    </div>
+                </div>
+            </div>
+        </div>
+    {/if}
+    <script>
+        {literal}
+            $(document).ready(function () {
+                $(".exd_btn").click(function (e) {
+                    e.preventDefault();
+                    e.stopPropagation();
+                    jQuery("#greyout").fadeIn();
+                    jQuery("#domainpopupcontainer").hide().removeClass('hidden').slideDown();
+                    var domainoption = jQuery(".domainoptions input:checked").val();
+                    var sld = jQuery("#" + domainoption + "sld").val();
+                    var tld = '';
+                    if (domainoption === 'existing_domain') {
+                        var domainoption = 'incart';
+                        var tld = jQuery("#existing_domainsld option:selected").text();
+                    }
+                    if (domainoption === 'subexisting_domain') {
+                        var domainoption = 'incart';
+                        var sld = $("#subexisting_domaindomainid").val();
+                    } else
+                        var tld = jQuery("#" + domainoption + "tld").val();
+                    WHMCS.http.jqClient.post("cart.php", {ajax: 1, a: "domainoptions", sld: sld, tld: tld, checktype: domainoption},
+                            function (data) {
+                                jQuery("#domainresults").html(data);
+                            });
+                });
+                $("#subdomainexisting_domaindomains").on("keyup", function () {
+                    if ($("#subdomainexisting_domaindomains").val() !== '') {
+                        $('#subdomainexisting_domaindomains').tooltip('hide');
+                        var oldvv = $("#subexisting_domainsld").find("option:selected").data("oldv");
+                        $("#subexisting_domaindomainid").val($("#subdomainexisting_domaindomains").val() + '.' + oldvv);
+                    } else {
+                        $("#subexisting_domaindomainid").val('');
+                    }
+                });
+                $("#subexisting_domainsld").on("change", function () {
+                    if ($("#subdomainexisting_domaindomains").val() !== '') {
+                        var oldvv = $("#subexisting_domainsld").find("option:selected").data("oldv");
+                        $("#subexisting_domaindomainid").val($("#subdomainexisting_domaindomains").val() + '.' + oldvv);
+                    } else {
+                        $("#subexisting_domaindomainid").val('');
+                    }
+                });
+            });
+        {/literal}
+    </script>
+{/if}               

+ 26 - 0
whmcs.json

@@ -0,0 +1,26 @@
+{
+  "schema": "1.0",
+  "type": "whmcs-addons",
+  "name": "ExistingDomains",
+  "version": "2.4.1",
+  "license": "proprietary",
+  "category": "domains",
+  "description": {
+    "name": "Existing Domains",
+    "tagline": "Clients who like to order product and still use the existing domain.",
+    "long": "This module will give the customers the ability to use domains they have already purchased. For example, a client first orders a domain name only and then comes back at a higher date and wants to order a hosting service and use the same domain name they already have on their account. With WHMCS, it will not be an easy to do that but with this module, WS Existing Domains, you can easily do it."
+  },
+  "logo": {
+    "filename": "logo.png"
+  },
+  "support": {
+    "docs_url": "https:\/\/whmcsservices.community\/forumdisplay.php?fid=28",
+	"learn_more": "https:\/\/www.whmcsservices.com\/existingdomains.php"
+  },
+  "authors": [
+    {
+      "name": "WHMCS Services",
+      "homepage": "https:\/\/www.whmcsservices.com\/"
+    }
+  ]
+}