Jump to content
bluerayconcepts

Dedicated Order form NS1 and 2 field removal

Recommended Posts

I am wanting to remove the required fields NS1 and NS2 on the dedicated server order form. I have been able to remove the fields but continue to get the must fill out required fields warning.

 

Does anyone know where and how to remove the required field setting for the NS1 and NS2 prefix on the dedicated server order form?

Edited by bluerayconcepts

Share this post


Link to post
Share on other sites

I don't think you can remove their requirement - it's hard-coded to check those fields aren't empty... :roll:

 

the simplest way around that would be, for dedicated servers, to not show them and pass them as hidden fields - that will allow the information to be passed to the cart, but not show either the fields or an error upon submission.

 

so in standard_cart/configureproduct.tpl, you could replace the nameserver code (which you say you have removed), with...

 

<input type="hidden" name="ns1prefix" class="form-control" id="inputNs1prefix" value=" ">
<input type="hidden" name="ns2prefix" class="form-control" id="inputNs2prefix" value=" ">

if you only wanted to remove it for some dedicated server products, you could use an {if} statement and specify the ones to ask for nameservers, but the above should remove it for all of your DS products.

 

I haven't testing passing a space as the value thoroughly - so if it causes an issue, just change the values passed to ns1 and ns2.

Share this post


Link to post
Share on other sites

no joke, it is Brian again!

<input type="hidden" name="ns1prefix" class="form-control" id="inputNs1prefix" value="noSN1">
<input type="hidden" name="ns2prefix" class="form-control" id="inputNs2prefix" value="noNS2">

works on WHMCS 8.1

empty space was not working

Share this post


Link to post
Share on other sites

Now this method working but have to comment the line locate under standard_cart/configuredomains.tpl

 

Have to comment this line

 

 

  <!--      {foreach from=$domain.fields key=domainfieldname item=domainfield}
                        <div class="form-group row">
                            <div class="col-sm-4 text-sm-right"">{$domainfieldname}:</div>
                            <div class="col-sm-8">{$domainfield}</div>
                        </div>
                    {/foreach}

                {/foreach}

                {if $atleastonenohosting}

                    <div class="sub-heading">
                        <span class="primary-bg-color">{$LANG.domainnameservers}</span>
                    </div>

                    <p>{$LANG.cartnameserversdesc}</p>

                    <div class="row">
                        <div class="col-sm-4">
                            <div class="form-group">
                                <label for="inputNs1">{$LANG.domainnameserver1}</label>
                                <input type="text" class="form-control" id="inputNs1" name="domainns1" value="{$domainns1}" />
                            </div>
                        </div>
                        <div class="col-sm-4">
                            <div class="form-group">
                                <label for="inputNs2">{$LANG.domainnameserver2}</label>
                                <input type="text" class="form-control" id="inputNs2" name="domainns2" value="{$domainns2}" />
                            </div>
                        </div>
                        <div class="col-sm-4">
                            <div class="form-group">
                                <label for="inputNs3">{$LANG.domainnameserver3}</label>
                                <input type="text" class="form-control" id="inputNs3" name="domainns3" value="{$domainns3}" />
                            </div>
                        </div>
                        <div class="col-sm-4">
                            <div class="form-group">
                                <label for="inputNs1">{$LANG.domainnameserver4}</label>
                                <input type="text" class="form-control" id="inputNs4" name="domainns4" value="{$domainns4}" />
                            </div>
                        </div>
                       <div class="col-sm-4">
                            <div class="form-group">
                                <label for="inputNs5">{$LANG.domainnameserver5}</label>
                                <input type="text" class="form-control" id="inputNs5" name="domainns5" value="{$domainns5}" />
                            </div> 
                        </div>
                    </div> -->

Share this post


Link to post
Share on other sites

Hello
Thanks for your help @brian!
I have removed all the fields(Hostname,Root password,ns1,ns2) with your help , but i see their names in whmcs client area whit no fields !
I send you a picture . 
How can i delete these names here ?

WHMCS Problem.PNG

Share this post


Link to post
Share on other sites

Hello everyone i fix the problem by delete the line between label tags .
I send you a picture of what i did . 
now i have another problem . when someone ordered a vps , the hostname of the vps is ( nohostname ) and if i dont change it manually the next order receive an error ( The hostname you entered is used before , please try another hostname )
how can i generate random names for every order hostnames ?

Thanks

WHMCS no NS.PNG

Share this post


Link to post
Share on other sites
Posted (edited)

I don't recommend to do any template changes in the template files, because you need to remember these changes when upgrading WHMCS. Instead use this hook to hide the fields via Javascript + insert a default value.
I have attached an example hook (can't post it here, my HTTP requests got blocked from the WHMCS server). You would save this into "includes/hooks/<choosable_filename>.php".

Please note that this is not the cleanest hook code-wise. You could remove the "ClientAreaPageCart" hook and just generate the values directly in ClientAreaFooterOutput. Also, the passwords are not generated cryptographically secure. I wrote this hook many years ago. But it should work and give you a good starting point if you want to do better. 

hook.zip

Edited by string

Share this post


Link to post
Share on other sites
13 hours ago, string said:

I don't recommend to do any template changes in the template files, because you need to remember these changes when upgrading WHMCS. Instead use this hook to hide the fields via Javascript + insert a default value.
I have attached an example hook (can't post it here, my HTTP requests got blocked from the WHMCS server). You would save this into "includes/hooks/<choosable_filename>.php".

Please note that this is not the cleanest hook code-wise. You could remove the "ClientAreaPageCart" hook and just generate the values directly in ClientAreaFooterOutput. Also, the passwords are not generated cryptographically secure. I wrote this hook many years ago. But it should work and give you a good starting point if you want to do better. 

hook.zip 645 B · 2 downloads

Wow this is awesome! Can you please help me adjust your hook to remove the root password field but show the hostname field?  We only use KVM and you  can't choose the root password for it. I think some customers may want to add a custom hostname.  Removing those annoying ns1 fields is a godsend.

Share this post


Link to post
Share on other sites
On 8/5/2021 at 3:45 PM, string said:

This should work: https://pastebin.com/aYQ7cA6d

 

Hey, i need similar to this please help me with that.

i need hook which enter any random hostname and password , I am looking for this from past few months and this is the most relatable thread I have found.

 

Thanks.

Share this post


Link to post
Share on other sites
On 9/6/2021 at 6:15 PM, Balram said:

i need hook which enter any random hostname and password , I am looking for this from past few months and this is the most relatable thread I have found.

Please see my previous hook. It does generate a random hostname and a password.

 

Share this post


Link to post
Share on other sites
On 8/4/2021 at 2:08 PM, string said:

I don't recommend to do any template changes in the template files, because you need to remember these changes when upgrading WHMCS. Instead use this hook to hide the fields via Javascript + insert a default value.
I have attached an example hook (can't post it here, my HTTP requests got blocked from the WHMCS server). You would save this into "includes/hooks/<choosable_filename>.php".

Please note that this is not the cleanest hook code-wise. You could remove the "ClientAreaPageCart" hook and just generate the values directly in ClientAreaFooterOutput. Also, the passwords are not generated cryptographically secure. I wrote this hook many years ago. But it should work and give you a good starting point if you want to do better. 

hook.zip 645 B · 20 downloads

i used this hook but its show this error:

Please correct the following errors before continuing:

  • You must enter a hostname for your server
  • You must enter your desired root password


    my whmcs version is 8.2.1

Share this post


Link to post
Share on other sites
5 hours ago, string said:

Please see my previous hook. It does generate a random hostname and a password.

Thanks @string, it worked.

i am looking for one more hook if possible for you please help.

we sell VPS services so hostname or domain most of the time user choose same and if user has many service they get confused which invoice is for which service.

Showing Dedicated ip on unpaid invoice or on all invoices whichever possible.

screenshot to understand better- https://prnt.sc/1rkz6wm

 

Share this post


Link to post
Share on other sites
21 hours ago, afshin-virus said:

i used this hook but its show this error:

I just tested it with WHMCS v8.2.1 and the hook works fine here. However, I noticed an error when generating the hostname, it did not consist of random characters. 

I suspect that you did not put the hook into the correct directory. Attached you ind the updated hook including the directory structure, so you can simply upload the extracted content directly to your WHMCS root directory.

hook.zip

Share this post


Link to post
Share on other sites
On 9/8/2021 at 2:46 PM, string said:

Please see my previous hook. It does generate a random hostname and a password.

 

Thanks @string, it worked.

i am looking for one more hook if possible for you please help.

we sell VPS services so hostname or domain most of the time user choose same and if user has many service they get confused which invoice is for which service.

Showing Dedicated ip on unpaid invoice or on all invoices whichever possible.

screenshot to understand better-https://prnt.sc/1rujiy3

Share this post


Link to post
Share on other sites

The invoice description can be changed via the WHMCS hook InvoiceCreationPreEmail

Unfortunately I don't have a hook for this. I would recommend to have a look in the marketplace if there is a module for it. Alternatively you can look for a developer in the Service Offers & Requests section, if nobody else can provide you a hook.

Share this post


Link to post
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