How can we improve WHMCS?

Share, discuss and vote for what you would like to see added to WHMCS

Ability to remove the nameserver options on order page

  • Jérémy Keusters shared this idea 11 years ago
  • Order Forms
  • 3 Comments


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

3 Comments

Login to post a comment.

This will work well, for modern order template, use

[co]
  • {if $productinfo.type eq "server"}
  • <h3>{$LANG.cartconfigserver}</h3>
  • <div class="serverconfig">
  • <table width="100%" cellspacing="0" cellpadding="0" class="configtable">
  • <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>
  • <input type="hidden" name="ns1prefix" size="10" value="ns1" />
  • <input type="hidden" name="ns2prefix" size="10" value="ns2" />
  • <input type="hidden" name="rootpw" size="20" value="1" /></td></tr>
  • </table>
  • </div>
  • {/if}
  • [/co]
    A little cleaner to look at int he template taking the logic away you can also do this in a hook file.
    [co]
  • #File: includes/hooks/input_hider.php
  • <?php
  • function hook_input_hider($vars) {
  • global $smarty;
  • $field_used = array ('products', 'thats', 'use', 'field');
  • if ( in_array($smarty->_tpl_vars['productinfo']['name'], $field_used) ) {
  • $smarty->assign('inputtype', 'text');
  • } else {
  • $smarty->assign('inputtype', 'hidden');
  • }
  • return;
  • }
  • add_hook('ClientAreaHead', 1, 'hook_input_hider');
  • ?>
  • [/co]
    [co]
  • #Template Change:
  • <input type="{$inputtype}" name="ns1prefix" size="10" value="{$server.ns1prefix}" />
  • [/co]
    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.
    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}