sebsimappus Posted January 4, 2017 Share Posted January 4, 2017 Domain extension in domain suggestion cart Hello, I come to you because I have been trying for several hours to find out how to use only the extension of the domain. I would like to replace the domain extension with an image. {if $othersuggestions} <div class="suggested-domains" style=""> <div class="panel-heading"> {$LANG.cartotherdomainsuggestions} </div> <div class="spotlight-tlds clearfix"> <div class="spotlight-tlds-container"> {foreach from=$othersuggestions item=other} <div class="spotlight-tld-container spotlight-tld-container-3"> <div class="spotlight-tld-news"> {$tld} </div> <!--<input type="checkbox" class="css-checkbox-check" name="domains[]" value="{$other.domain}" id="checkboxdomain {$other.domain}" onchange="{if $smarty.request.adddomaincustom eq '1'}adddomain(this.value,$(this).is(':checked'));{else}completedomain(this.value,$(this).is(':checked'));{/if}" /> <label class="css-label-check radGroup1" for="checkboxdomain {$other.domain}"></label>--> <div class="prepend-icon"> <label class="field-icon"> <i class="glyphicon glyphicon-shopping-cart"></i> </label> <select id="new-select-domain" class="field" onchange="{if $smarty.request.adddomaincustom eq '1'} adddomain(); {else} completedomain();{/if}" name="domainsregperiod[{$other.domain}]"> {foreach from=$other.regoptions key=period item=regoption} {if $regoption.register} <option value="{$period}">{$period} {$LANG.orderyears} @ {$regoption.register}</option> {/if} {/foreach} </select> </div> </div> {/foreach} </div> </div> {assign var='continueok' value=true} {/if} Big thanks 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted January 4, 2017 Share Posted January 4, 2017 you mean that you want to use an image for ".com"; another image for ".net" etc ? something along the lines of...?? with v7, these domain suggestion searches uses ajax/jquery far more than previous versions - so there's little that you can do in the Smarty templates by tweaking the above code. what you'll need to do is edit the jquery code - specifically /templates/orderforms/standard_cart/js/scripts.min.js and change... .find("span.extension").html("."+a).end() to... .find("span.extension").html("<img src='"+a+".png'>").end() then you'll need to upload your images/logos for every TLD (I hope you don't have hundreds!) to your WHMCS installation - for simplicity, I haven't bothered with paths and i've just uploaded the images to the WHMCS root - but you could upload them anywhere and change the above code to use the correct path. there are two other things to bear in mind... 1. be aware that WHMCS might (likely will) update the scripts.min.js file during future WHMCS updates - so remember to check and add the above code back in if that occurs. 2. it's possible that a future WHMCS update to the file may prevent this solution from working - so again, check after each update that it still works. 0 Quote Link to comment Share on other sites More sharing options...
sebsimappus Posted February 18, 2017 Author Share Posted February 18, 2017 Hello Thanks for your feedback, I do not use standard_cart, maybe you have another solution? thank you in advance 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted February 19, 2017 Share Posted February 19, 2017 I do not use standard_cart, maybe you have another solution? you'll have to give me some sort of clue as to which orderform template you are using - otherwise it's going to be difficult to advise! 0 Quote Link to comment Share on other sites More sharing options...
sebsimappus Posted February 19, 2017 Author Share Posted February 19, 2017 Hello, Thanks for your feedback, I use ajaxcart thank you in advance 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted February 19, 2017 Share Posted February 19, 2017 I use ajaxcart oh ok - ajaxcart was removed in v6 in 2015 and so hasn't been updated for 2 years... which version of WHMCS are you using it with ?? looking at my old v5 dev, in domainoptions.tpl you should be able to split $other.domain into sld and tld using Smarty; then replace tld with an image... how to do it exactly would depend on your WHMCS version - if it's 6 or 7, then it should be easy - if it's v5, it might be a little harder. 0 Quote Link to comment Share on other sites More sharing options...
sebsimappus Posted February 20, 2017 Author Share Posted February 20, 2017 Hello, Thanks for your feedback, I use the latest version of WHMCS, I have updated ajaxcart for WHMCS 7.1.1 thank you in advance 0 Quote Link to comment Share on other sites More sharing options...
AffordableDomainsCanada Posted February 20, 2017 Share Posted February 20, 2017 Does anyone know where to find a good pack of the domain tld images ? 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted February 20, 2017 Share Posted February 20, 2017 I use the latest version of WHMCS, I have updated ajaxcart for WHMCS 7.1.1 aaah - now the code in the first post makes more sense! it would probably be helpful to have an image/url link (by PM if necessary) of what it looks like, as from the above code, I can't quite tell where it's displaying the domain name... I assume it should be inside the label? <input type="checkbox" class="css-checkbox-check" name="domains[]" value="{$other.domain}" id="checkboxdomain {$other.domain}" onchange="{if $smarty.request.adddomaincustom eq '1'}adddomain(this.value,$(this).is(':checked'));{else}completedomain(this.value,$(this).is(':checked'));{/if}" /> <label class="css-label-check radGroup1" for="checkboxdomain {$other.domain}">{$other.domain}</label> if so, then the solution will be as suggested earlier to split $other.domain into SLD and TLD, then replace TLD with an image. {assign domsearch $other.domain|strpos:"."} {assign sld $other.domain|substr:0:$domsearch} {assign tld $other.domain|substr:($domsearch+1)} {assign tldlogo "{$tld|strtolower}.png"} <input type="checkbox" class="css-checkbox-check" name="domains[]" value="{$other.domain}" id="checkboxdomain {$other.domain}" onchange="{if $smarty.request.adddomaincustom eq '1'}adddomain(this.value,$(this).is(':checked'));{else}completedomain(this.value,$(this).is(':checked'));{/if}" /> <label class="css-label-check radGroup1" for="checkboxdomain {$other.domain}">{if file_exists($tldlogo)}{$sld}<img src="{$tldlogo}">{else}{$other.domain}{/if}</label> now I can't test it using your template, but I think it should work... I quickly tweaked the modern/domainoptions.tpl template (which also uses $other.domain) to do this and it works fine. it works by first splitting $other.domain into 2 parts: SLD (whmcs2017); TLD (com); it then checks to see if there's an logo image available for TLD... if there is, it outputs SLD+logo; if there isn't, it just outputs $other.domain - that way, the results will always be shown correctly and gives you the option of only using logos for those TLDs you want to highlight. for simplicity, the logo images are currently assumed to be in the root of the whmcs installation - if you want to move them to assets etc, that's not a problem - just adjust the path in the $tldlogo variable. Does anyone know where to find a good pack of the domain tld images ? I certainly don't! when I wrote my original answer, I used the logos from the marketing kits I got from one of our registrars and resized each one online - until you try to resize them to roughly the same dimensions, it's surprising how varied their sizes are... let's just say, it was a pain to do and that's why I only did 5. 0 Quote Link to comment Share on other sites More sharing options...
AffordableDomainsCanada Posted February 20, 2017 Share Posted February 20, 2017 I certainly don't! when I wrote my original answer, I used the logos from the marketing kits I got from one of our registrars and resized each one online - until you try to resize them to roughly the same dimensions, it's surprising how varied their sizes are... let's just say, it was a pain to do and that's why I only did 5. I have been grabbing them from the marketing kits also from my registrar, and its a pain in the arse. I havnt got to the resizing yet, and I have 513 domain extensions I am going to try and get to them all. 0 Quote Link to comment Share on other sites More sharing options...
sebsimappus Posted February 20, 2017 Author Share Posted February 20, 2017 Hello, Is a big thank you for your help, I add your code, but unfortunately it does not work, to make simple it does not mark anything, it's just white. The smarty php tag function is enabled in the admin section. thank you in advance cordially 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted February 20, 2017 Share Posted February 20, 2017 Is a big thank you for your help, I add your code, but unfortunately it does not work, to make simple it does not mark anything, it's just white.The smarty php tag function is enabled in the admin section. you shouldn't need to do that for this - it's not PHP, just Smarty - so you don't need to wrap it in {php} tags - just copy & paste into the template. 0 Quote Link to comment Share on other sites More sharing options...
sebsimappus Posted February 20, 2017 Author Share Posted February 20, 2017 Hello, A big thank you to you, it works I just can adjust your code one thousand thanks to you. Nice work, you have class cordially 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.