We are currently in theĀ processĀ of moving our billing software from AWBS to WHMCS.
One of the things that was annoying in AWBS was that when buying a UK Domain name (.co.uk etc) a client was given the option to enter a company number even when signing up as an Individual ( Individual registrations account for about 95%+ of uk domain registrations ). This confused clients, and probably made some people abandon the cart.
I was somewhat frustrated to see that WHMCS doesn’t seem to have addressed the situation any better, so I thought it was time to take things into my own hands. I’ve written some jQuery that removes the options for individual users. I’m sure there is a better way to do this – but for now this seems to work.
Your template (/templates/orderforms/web20cart/configuredomains.tpl) will have to look like this for this jQuery to work:
<p><input type="text" name="epp[{$num}]" size="20" value="{$domain.eppvalue}" />
{$LANG.domaineppcodedesc}</p>
{/if}
{if $domain.dnsmanagement}
<p><input type="checkbox" name="dnsmanagement[{$num}]"{if $domain.dnsmanagementselected} checked{/if} />
{$LANG.domaindnsmanagement} ({$domain.dnsmanagementprice})</p>
{/if}
{if $domain.emailforwarding}
<p><input type="checkbox" name="emailforwarding[{$num}]"{if $domain.emailforwardingselected} checked{/if} />
{$LANG.domainemailforwarding} ({$domain.emailforwardingprice})</p>
{/if}
{if $domain.idprotection}
<p><input type="checkbox" name="idprotection[{$num}]"{if $domain.idprotectionselected} checked{/if} />
{$LANG.domainidprotection} ({$domain.idprotectionprice})</p>
{/if}
{foreach key=domainfieldname item=domainfield from=$domain.fields}
<p><label>{$domainfieldname}:</label> {$domainfield}</p>
{/foreach} </div>
which generates this HTML:
<p>
<label>Legal Type:</label>
<select name="domainfield[0][0]">
</p>
<p style="display: none;">
<label>Company ID Number:</label>
<input type="text" value="" name="domainfield[0][1]" size="30" disabled="">
</p>
<p>
<label>Registrant Name:</label>
<input type="text" value="" name="domainfield[0][2]" size="30">
*
</p>
<p>
<label>WHOIS Opt-out:</label>
<input type="checkbox" name="domainfield[0][3]">
</p>
</div>
And here is the jQuery. I included this at the bottom of the site, just before the close body tag.
$(‘select[name^="domainfield"]‘).each(function(){
$(this).parent().parent().find(‘select[name$="[0]"]’).change(function(){
if ($(this).val() == "Individual" || $(this).val() == "Sole Trader"){
$(this).parent().parent().find(‘input[name$="[1]"]’).attr("disabled", true);
$(this).parent().parent().find(‘input[name$="[1]"]’).parent().hide();
}
else{
$(this).parent().parent().find(‘input[name$="[1]"]’).removeAttr("disabled");
$(this).parent().parent().find(‘input[name$="[1]"]’).parent().show();
}
})
});
// Disables Company Numbers for UK Domains on page load
$(‘select[name$="[0]"]’).each(function(){
if ($(this).val() == "Individual" || $(this).val() == "Sole Trader"){
$(this).parent().parent().find(‘input[name$="[1]"]’).attr("disabled", true);
$(this).parent().parent().find(‘input[name$="[1]"]’).parent().hide();
}
else{
$(this).parent().parent().find(‘input[name$="[1]"]’).removeAttr("disabled");
$(this).parent().parent().find(‘input[name$="[1]"]’).parent().show();
}
});