macktic Posted June 23, 2014 Share Posted June 23, 2014 I am looking for the following option: If a client orders a domain only, without hosting, i want him to fill out a custom field. This custom field would then make him choose between: * add domain to current account:..... * park domain on top of domain:..... * domain hosting only, on my dns servers * domain registration only, use different dns servers. Of course if there is a better way out there to actually automate this in stead of making it a custom field that then has to be actioned by hand, I am happy to hear it. If it a commercial add-on that's fine, as long as it does what I need. Thanks, Seb. 0 Quote Link to comment Share on other sites More sharing options...
WHMCS Chance Posted June 23, 2014 Share Posted June 23, 2014 Hey Seb, You would need to do this with a custom field for the domain as there is no automated way to accomplish the tasks you are wanting. However, you may find this is something a member of our community has already developed, so it would be worth browsing our app store: http://www.whmcs.com/appstore You could also check with modules garden, our official partner, and see if they have something like this to help you or they might be able to give you a quote on what it would cost if they could do that: Custom Development Services offered by ModulesGarden include: * Custom Gateway Module Development * Custom Registrar Module Development * Custom Provisioning Module Development * Custom Addon Module Development * Custom Reports * Custom Hooks * Custom Theme Development For more information about this partnership: http://www.whmcs.com/partners/custom-development-modules/ 0 Quote Link to comment Share on other sites More sharing options...
macktic Posted June 24, 2014 Author Share Posted June 24, 2014 That was just the problem, how do I setup a custom field to only show if a customer orders a domain without hosting? 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted June 24, 2014 Share Posted June 24, 2014 which order form template are you using? 0 Quote Link to comment Share on other sites More sharing options...
macktic Posted June 24, 2014 Author Share Posted June 24, 2014 Flatern cart. But I have got no problem adapting any template as long as I have got some sort of idea what to put in. 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted June 24, 2014 Share Posted June 24, 2014 well I don't have the Flatern files locally, but I think the principle should still work - this isn't by any means a finished solution, but might point you in the right direction... in whmcs, you have the option to additional domain fields for specific tlds... http://docs.whmcs.com/Domains_Configuration#TLD_Specific_Additional_Domain_Fields I don't think you can make them apply to all tlds, so if you're only offering a few tlds, then you can just copy & paste the fields for each tld... if you're offering hundreds, then you might need to code it directly into the template file... but as an example, let's say we create a new custom field by adding the following code to includes/additionaldomainfields.php $additionaldomainfields[".com"][] = array("Name" => "Domain Options", "LangVar" => "domainoptions", "Type" => "dropdown", "Options" => "Add Domain To Current Account, Park Domain, Domain Hosting Only, Domain Registration Only", "Default" => "Add Domain To Current Account",); with this, when someone orders a .com domain, then will be able to select their choice from a dropdown. by default, they would be see this field whether they just registered a domain with hosting or not - they might not necessarily see it during the ordering process, but they would have the option to see it by clicking on the 'configure domain extras' link in viewcart. this can be prevented by modifying the configuredomains.tpl product in your order-form template - taking Modern as an example, it uses the following to show the additional domain fields... {foreach key=domainfieldname item=domainfield from=$domain.fields} <tr><td>{$domainfieldname}:</td><td>{$domainfield}</td></tr> {/foreach} but we can add an {if} statement to prevent the new field being shown if the domain is linked to hosting... {foreach key=domainfieldname item=domainfield from=$domain.fields} {if $domainfieldname eq "Domain Options" and $domain.hosting eq false} <tr><td>{$domainfieldname}:</td><td>{$domainfield}</td></tr> {/if} {/foreach} there are (at least!) two possible issues with this solution... firstly, the need to copy&paste the field entries for multiple tlds - but if you only have a few, we can ignore that for now... the second is that I don't think you can do this with just one field - certainly for the first two options of the dropdown, you would need a second field to store the account the domain is being added to or parked with. it's not a problem to add a second field... $additionaldomainfields[".com"][] = array("Name" => "Account Name", "LangVar" => "domainaccount", "Type" => "text", "Size" => "20", "Default" => "", "Required" => false,); again you could tweak the template to only show this field too if the domain had no hosting, but if would be shown regardless of the value of the domain options dropdown - unless you start using javascript! it might be an option to use a method similar to that used in configureproductdomains.tpl - when you are ordering a product that requires a domain, you are given the option to register, transfer, use existing domain etc... with each option opening up additional fields. however you choose to do it, the important point will be using the value of $domain.hosting to determine whether a domain has hosting linked to it or not. 0 Quote Link to comment Share on other sites More sharing options...
macktic Posted June 24, 2014 Author Share Posted June 24, 2014 Thanks for the detailed info, this should get me a lot further. Let me go and have a play 0 Quote Link to comment Share on other sites More sharing options...
macktic Posted June 25, 2014 Author Share Posted June 25, 2014 I have actually gone an other way, and it is still a work in progress but I have started with editing configuredomains.tpl Adding the following: {if $loggedin} {php} $userid = $this->_tpl_vars['clientsdetails']['userid']; $resultdomains = mysql_query("SELECT id, domain FROM tbldomains WHERE userid=$userid AND status='active'"); $resulthostingacc = mysql_query("SELECT id, username FROM tblhosting WHERE userid=$userid AND domainstatus='active' AND username!=''"); $datadomains = mysql_fetch_array($resultdomains); $datahostingacc = mysql_fetch_array($resulthostingacc); {/php} <div class="panel panel-default"> <div class="panel-heading"> <h3 class="panel-title">Domain Pointing</h3> <p><small>Please choose where you want the domain pointed</small></p> </div> <table class="table"> <tr> <td><input type="radio" name="pointing" class="form-control" value="addon" /></td> <td><p class="form-control-static">Added to account:</p></td> <td><select name="addon" class="form-control"> {php} foreach ($datahostingacc AS $acc) echo "<option value='".$acc.id."'>".$acc.username."</option>"; {/php} </select> </td> </tr> <tr> <td><input type="radio" name="pointing" class="form-control" value="park" /></td> <td><p class="form-control-static">Parked on domain:</p></td> <td><select name="parked" class="form-control"> {php} foreach ($datadomains AS $dom) echo "<option value='".$dom.id."'>".$dom.domain."</option>"; {/php} </select> </td> </tr> <tr> <td><input type="radio" name="pointing" class="form-control" value="sns" /></td> <td><p class="form-control-static">Domain hosting only:</p></td> <td>Use Sortanet nameservers</td> </tr> <tr> <td><input type="radio" name="pointing" class="form-control" value="ons" /></td> <td><p class="form-control-static">Registration only:</p></td> <td>use own nameservers</td> </tr> </table> {else} This works as far as the fields I want are shown, just need to tweak something as my drop downs aren't quite showing what I want, though the right info is in there somewhere so the database connection works. Then I need to make sure I catch the filled out info. Sigh, someone must have done something like this before. 0 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.