ivaserver Posted September 2, 2016 Share Posted September 2, 2016 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 0 Quote Link to comment Share on other sites More sharing options...
zomex Posted September 2, 2016 Share Posted September 2, 2016 Hello, Which dropdown menu are you looking to remove them from? On the cart or domainchecker.php page? 0 Quote Link to comment Share on other sites More sharing options...
ivaserver Posted September 2, 2016 Author Share Posted September 2, 2016 Hi Zomex It is the cart Product Configuration page. I want **hosting to register a new domain for me. I want to transfer my domain to **Hosting I will update my nameservers on an existing domain Or I will register a new domain. Many thanks 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted September 3, 2016 Share Posted September 3, 2016 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! 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. 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. 0 Quote Link to comment Share on other sites More sharing options...
ivaserver Posted September 3, 2016 Author Share Posted September 3, 2016 Thank you very much Brian. This is very good! I have implemented the first part for new and transferring UK domains and it works a treat. I do only want this to apply to one product: pid=34 Could you advise how I edit {if} statement many thanks 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted September 3, 2016 Share Posted September 3, 2016 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> 0 Quote Link to comment Share on other sites More sharing options...
ivaserver Posted September 3, 2016 Author Share Posted September 3, 2016 Thank you Brian Your a life saver Have a great weekend and many thanks. 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.