Jump to content

limit URL choice for domain search


ivaserver

Recommended Posts

Please could you advise the best way to achieve the following.

only UK domains are offered,

 

I have achieved this spatially by configuring standard WHOIS to only show UK domains. in settings > domains.

 

But I can't work out how remove the other domains such as .com, net etc from the drop down menu without doing it globally.

 

 

Is there a way to have only uk domains in the drop down without changing it globally for orders outside of this UK domain promotion.

 

Thanks

Link to comment
Share on other sites

if you were going to do this by editing templates, you could do it in two steps - maybe just one if you don't need the second step! :idea:

 

i'm going to assume that you're using Standard Cart orderform template - if so, to limit the TLDs in the dropdown list, you would edit 'configureproductdomain.tpl' and change...

 

                                                <select id="registertld" class="form-control">
                                                   {foreach from=$registertlds item=listtld}
                                                       <option value="{$listtld}"{if $listtld eq $tld} selected="selected"{/if}>{$listtld}</option>
                                                   {/foreach}
                                               </select>

to...

 

                                                <select id="registertld" class="form-control">
                                               {assign 'allowedtlds' array('.uk', '.co.uk', '.org.uk', '.me.uk', '.plc.uk')}
                                                   {foreach from=$registertlds item=listtld}
                                                       {if $listtld|in_array:$allowedtlds}
                                                           <option value="{$listtld}"{if $listtld eq $tld} selected="selected"{/if}>{$listtld}</option>
                                                       {/if}
                                                   {/foreach}
                                               </select>

this will affect all products that require hosting - if you only need it to work with specific products (and allow other products to register other TLDs), then it's a simple tweak to the {if} statement with the option of using a second array if it's a lot of products.

 

also, if you need to do this for transfers too, then you can use similar code in the {foreach from=$transfertlds item=listtld} block of code - though if you're going to do that, i'd be tempted to move the {assign} line of code to the top of the template so that it's only declared once. :idea:

 

the second optional step is if you want to only show suggested alternative TLDs from .uk in the results - to do that, you would make a similar modification to domainoptions.tpl - specifically the <div class="row domain-suggestions"> block of code...

 

        <div class="row domain-suggestions">
           {assign 'allowedtlds' array('uk', 'co.uk', 'org.uk', 'me.uk', 'plc.uk')}
           {foreach $searchResults.suggestions as $num => $result}
               {if $result.tld|in_array:$allowedtlds}
               <div class="col-sm-6 margin-bottom-5">
                   <input type="hidden" name="domainsregperiod[{$result.domainName}]" value="{$result.shortestPeriod.period}" />
                   <label>
                       <input type="checkbox" name="domains[]" value="{$result.domainName}" id="domainSuggestion{$num}" class="suggested-domains" />
                       {$result.domainName}
                   </label>
                   <div class="pull-right">
                       {if count($result.pricing) > 1}
                           <div class="btn-group domain-suggestion-pricing">
                       {/if}
                       <button type="button" class="btn btn-default btn-sm" onclick="selectDomainPricing('{$result.domainName}', '{$result.shortestPeriod.register}', {$result.shortestPeriod.period}, '{$LANG.orderyears}', '{$num}')">
                           <span name="{$result.domainName}-selected-price">
                               <b class="glyphicon glyphicon-shopping-cart"></b>
                               {$result.shortestPeriod.period} {$LANG.orderyears} @ {$result.shortestPeriod.register}
                           </span>
                       </button>
                       {if count($result.pricing) > 1}
                           <button type="button" class="btn btn-default btn-sm dropdown-toggle additional-options" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
                               <b class="caret"></b>
                               <span class="sr-only">
                                   {lang key="domainChecker.additionalPricingOptions" domain=$result.domainName}
                               </span>
                           </button>
                           <ul class="dropdown-menu" role="menu">
                               {foreach $result.pricing as $years => $price}
                                   <li>
                                       <a href="#" onclick="selectDomainPricing('{$result.domainName}', '{$price.register}', {$years}, '{$LANG.orderyears}', '{$num}');return false;">
                                           <b class="glyphicon glyphicon-shopping-cart"></b>
                                           {$years} {$LANG.orderyears} @ {$price.register}
                                       </a>
                                   </li>
                               {/foreach}
                           </ul>
                       </div>
                       {/if}
                   </div>
               </div>
               {/if}
           {/foreach}
       </div>

note that the value of the array is slightly different... as with the other template tweak, this will affect results for all products, but if required, you can specify that these .uk specific results only occur for some products too. :)

Link to comment
Share on other sites

try using...

 

                                                <select id="registertld" class="form-control">
                                               {assign 'allowedtlds' array('.uk', '.co.uk', '.org.uk', '.me.uk', '.plc.uk')}
                                                   {foreach from=$registertlds item=listtld}
                                                       {if $pid eq '34'}
                                                           {if $listtld|in_array:$allowedtlds}
                                                               <option value="{$listtld}"{if $listtld eq $tld} selected="selected"{/if}>{$listtld}</option>
                                                           {/if}
                                                       {else}
                                                           <option value="{$listtld}"{if $listtld eq $tld} selected="selected"{/if}>{$listtld}</option>
                                                       {/if}
                                                   {/foreach}
                                               </select> 

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