Feature Requests
Share ideas, discuss and vote on requests from other users in community
 

Ability to remove the nameserver options on order page

Jérémy Keusters shared this idea 6 years ago
Already Possible

Hello,

My idea is to give the ability to remove the nameserver options on the order page because for example, when you sell VPS hosting, you don't really need Nameservers for your VPS. So it's useless.

It would be nice if you could configure it for every product separately.

Kind Regards,

Jérémy

Best Answer
photo

This is possible with a template customisation: http://docs.whmcs.com/Order_Form_Templates

To only hide a field for certain products then something along the lines of this could be used:

{if $productinfo.name eq 'Bronze'}<input type="hidden" name="ns1prefix" size="10" value="N/A" />

{else}

<input type="text" name="ns1prefix" size="10" value="{$server.ns1prefix}" />

{/if}

Comments (3)

photo
1

This is possible with a template customisation: http://docs.whmcs.com/Order_Form_Templates

To only hide a field for certain products then something along the lines of this could be used:

{if $productinfo.name eq 'Bronze'}<input type="hidden" name="ns1prefix" size="10" value="N/A" />

{else}

<input type="text" name="ns1prefix" size="10" value="{$server.ns1prefix}" />

{/if}

photo
1

A little cleaner to look at int he template taking the logic away you can also do this in a hook file.

  1. #File: includes/hooks/input_hider.php
  2. <?php
  3. function hook_input_hider($vars) {
  4. global $smarty;
  5. $field_used = array ('products', 'thats', 'use', 'field');
  6. if ( in_array($smarty->_tpl_vars['productinfo']['name'], $field_used) ) {
  7. $smarty->assign('inputtype', 'text');
  8. } else {
  9. $smarty->assign('inputtype', 'hidden');
  10. }
  11. return;
  12. }
  13. add_hook('ClientAreaHead', 1, 'hook_input_hider');
  14. ?>

  1. #Template Change:
  2. <input type="{$inputtype}" name="ns1prefix" size="10" value="{$server.ns1prefix}" />

Feature Request::: Improve the code formatting options, Cant indent the lines.

Edit note, I always get the in_array the wrong way around.. I have edited it to correct, should be in_array($needle, $haystack) i need to remember that.

As a final side note: Nameservers with a VPS are actually very valid, There are many people that want private name servers and a great many hostin providers that provide a VPS as a blank canvas. If you are not offering them setup yourself then for you they are not needed, but that doesnt affect many hosts who do infact use them.

photo
1

This will work well, for modern order template, use

  1. {if $productinfo.type eq "server"}
  2. <h3>{$LANG.cartconfigserver}</h3>
  3. <div class="serverconfig">
  4. <table width="100%" cellspacing="0" cellpadding="0" class="configtable">
  5. <tr><td class="fieldlabel">{$LANG.serverhostname}:</td><td class="fieldarea"><input type="text" name="hostname" size="30" value="{$server.hostname}"placeholder="servername.yourdomain.com" /> </td></tr>
  6. <input type="hidden" name="ns1prefix" size="10" value="ns1" />
  7. <input type="hidden" name="ns2prefix" size="10" value="ns2" />
  8. <input type="hidden" name="rootpw" size="20" value="1" /></td></tr>
  9. </table>
  10. </div>
  11. {/if}

be90b352151e3a600fe27414a3134f77