Jump to content

Custom field on domain only order


macktic

Recommended Posts

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.

Link to comment
Share on other sites

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/

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

Join the conversation

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

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated