Jump to content

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
Link to comment
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.

Link to comment
Share on other sites

  • 4 years later...

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

Link to comment
Share on other sites

  • 3 months later...

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> -->
Link to comment
Share on other sites

  • 2 months later...

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

Link to comment
Share on other sites

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
Link to comment
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.

Link to comment
Share on other sites

  • 1 month later...
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.

 

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

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

 

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

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

Link to comment
Share on other sites

  • 1 year later...
On 9/9/2021 at 2:24 AM, string said:

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 928 B · 197 downloads

Amazing, thanks so much for this. Working great on whmcs 8.7.1 and php 8.1.

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