Jump to content

domainregister.tpl


Recommended Posts

OK so what I am trying to do is, when a client wants to register a new domain, I am including 2 free email address with the domain. Soo. I have created a bundle, and the bundle link is working, its asking for the domain, and then the 2 free email address's and then goes throught the checkout processs, great! So now I want when a client is on /cart.php?a=add&domain=register and then add the domain then then click check out, I want that link to go to

 

/clientarea/cart.php?a=add&bid=2

 

So I found this in the domainregister.tpl in the standard_cart orderform template folder.

 

<form method="post" action="cart.php" id="frmDomainChecker">

 

ive tried to change the "cart.php" but it doesnt redirect to the bundle link, it takes me to /cart.php?a=confdomains

 

Is there anyway to change this ?

Link to comment
Share on other sites

i've tried to change the "cart.php" but it doesn't redirect to the bundle link, it takes me to /cart.php?a=confdomains

that sort of makes sense, because a bundle is really just an envelope that contains x number of products/domains/addons etc... and so adding a bundle link during the order process might cause issues.

 

coming at this from another angle, if the 2 email addresses are just a dummy product using product custom fields (with no automation), I might be tempted to simplify the ordering process and get rid of the bundle completely and instead use Domain Custom Fields - technically called Additional Domain Fields - they will be able to store the values of the two email addresses and that info will be available to you in the client's profile for each domain.

 

the plus side to this is that you shouldn't need to make any template changes to the cart at all - the user will add the domain(s) to the cart, press checkout and then be taken to the domain configuration page automatically - where they can enter the email addresses for the ordered domains.... I suppose you could change the "Checkout" button to something else so that it makes some sense, but that's just a simple Language Override.

 

the downside is that I don't think it's possible (or if it is, it's undocumented!) to apply ADF to all TLDs in a simple way... I think it can only apply to one at a time... therefore, you're going to need to create an additionalfields.php file, create a custom field (2 in your case), and then copy it for all your existing TLDs (or at least those that you want to offer 2 free emails with) - it's going to be something along the lines of...

 

<?php

$additionaldomainfields['custom'][] = array(
   "Name" => "Free Email Address #1",
   "Type" => "text",
   "Size" => "30",
);

$additionaldomainfields['custom'][] = array(
   "Name" => "Free Email Address #2",
   "Type" => "text",
   "Size" => "30",
);

$additionaldomainfields['.co.uk'] = $additionaldomainfields['custom'];
$additionaldomainfields['.com'] = $additionaldomainfields['custom'];

so in the above example, the two fields will be shown to those ordering .com and/or .co.uk domains... any other TLD won't add the two fields...

 

as I say, I can't think of a way off hand to automate it in the file itself, so you may be left with a lot of copy&paste to do to get all your TLDs on the list... :roll:

 

I suppose you could write a PHP script / feed to loop through the TLD array/table and generate the output for you to c&p in one go into the additionalfields file... :?:

voila - I quickly knocked up the code below... works for me when uploaded to the feeds directory and called directly... if uploading elsewhere in WHMCS, just change the two require paths... :idea:

 

<?php

require("../init.php");
require("../includes/domainfunctions.php");

$currency = getCurrency();
$tldslist = getTLDList();

foreach ($tldslist AS $tld) {
   $code .= sprintf("$additionaldomainfields['%s'] = $additionaldomainfields['custom'];<br>",htmlspecialchars($tld, ENT_QUOTES, 'UTF-8'));
}

echo $code;

I guess there may be another downside to this idea.. in that the 2 ADF will be shown when ordering other products that require a domain... sighs... if that's an issue, then you're either left with going back to the bundle idea, or hiding these 2 fields if ordered with a product...

 

if you wanted to show the 2 fields during domain registration, but hide them when ordered with hosting (a product that requires a domain), you should only need to make a minor tweak to the configuredomains.tpl template by changing...

 

                    {foreach from=$domain.fields key=domainfieldname item=domainfield}
                       <div class="row">
                           <div class="col-sm-4">{$domainfieldname}:</div>
                           <div class="col-sm-8">{$domainfield}</div>
                       </div>
                   {/foreach}

to...

                    {foreach from=$domain.fields key=domainfieldname item=domainfield}
                       {if !$domain.hosting or ($domainfieldname neq 'Free Email Address #1' and $domainfieldname neq 'Free Email Address #2')}
                           <div class="row">
                               <div class="col-sm-4">{$domainfieldname}:</div>
                               <div class="col-sm-8">{$domainfield}</div>
                           </div>
                       {/if}
                   {/foreach}

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