Customize WHMCS Order Form Cart Template


This article provides a guide for how to customize WHMCS order form cart template for improved compatibility with VPS Reseller WHMCS module.

Customize WHMCS Order Form Cart Template

In order to improve compatibility with VPS Reseller WHMCS module, we recommend you customize WHMCS order form cart template.

Edit configureproduct.tpl:

  • Open your order form template's configureproduct.tpl file in your preferred text editor (for this guide, we will be using standard_cart order form template, which is located at /path/to/whmcs/templates/orderforms/standard_cart/configureproduct.tpl).
  • Find the following in configureproduct.tpl:
                            {if $productinfo.type eq "server"}
                                <div class="sub-heading">
                                    <span class="primary-bg-color">{$LANG.cartconfigserver}</span>
                                </div>
    
                                <div class="field-container">
    
                                    <div class="row">
                                        <div class="col-sm-6">
                                            <div class="form-group">
                                                <label for="inputHostname">{$LANG.serverhostname}</label>
                                                <input type="text" name="hostname" class="form-control" id="inputHostname" value="{$server.hostname}" placeholder="servername.example.com">
                                            </div>
                                        </div>
                                        <div class="col-sm-6">
                                            <div class="form-group">
                                                <label for="inputRootpw">{$LANG.serverrootpw}</label>
                                                <input type="password" name="rootpw" class="form-control" id="inputRootpw" value="{$server.rootpw}">
                                            </div>
                                        </div>
                                    </div>
    
                                    <div class="row">
                                        <div class="col-sm-6">
                                            <div class="form-group">
                                                <label for="inputNs1prefix">{$LANG.serverns1prefix}</label>
                                                <input type="text" name="ns1prefix" class="form-control" id="inputNs1prefix" value="{$server.ns1prefix}" placeholder="ns1">
                                            </div>
                                        </div>
                                        <div class="col-sm-6">
                                            <div class="form-group">
                                                <label for="inputNs2prefix">{$LANG.serverns2prefix}</label>
                                                <input type="text" name="ns2prefix" class="form-control" id="inputNs2prefix" value="{$server.ns2prefix}" placeholder="ns2">
                                            </div>
                                        </div>
                                    </div>
    
                                </div>
                            {/if}
  • Replace the above section with the following:
                            {if $productinfo.type eq "server"}
                                <div class="sub-heading">
                                    <span class="primary-bg-color">{$LANG.cartconfigserver}</span>
                                </div>
    
                                <div class="field-container">
    
                                    <div class="row">
                                        <div class="col-sm-12">
                                            <div class="form-group">
                                                <label for="inputHostname">{$LANG.serverhostname}</label>
                                                <input type="text" name="hostname" class="form-control" id="inputHostname" value="{$server.hostname}" placeholder="servername.example.com">
                                            </div>
                                        </div>
                                        <div class="col-sm-12" style="display:none">
                                            <div class="form-group">
                                                <label for="inputRootpw">{$LANG.serverrootpw}</label>
                                                <input type="password" name="rootpw" class="form-control" id="inputRootpw" value="{"@#$*123456789abcdefghkmnpqrstwxyzABCDEFGHKMNPQRSTUVWXYZ"|str_shuffle|truncate:16:""}">
                                            </div>
                                        </div>
                                    </div>
    
                                    <div class="row" style="display:none">
                                        <div class="col-sm-6">
                                            <div class="form-group">
                                                <label for="inputNs1prefix">{$LANG.serverns1prefix}</label>
                                                <input type="text" name="ns1prefix" class="form-control" id="inputNs1prefix" value="notapplicable" placeholder="notapplicable">
                                            </div>
                                        </div>
                                        <div class="col-sm-6">
                                            <div class="form-group">
                                                <label for="inputNs2prefix">{$LANG.serverns2prefix}</label>
                                                <input type="text" name="ns2prefix" class="form-control" id="inputNs2prefix" value="notapplicable" placeholder="notapplicable">
                                            </div>
                                        </div>
                                    </div>
    
                                </div>
                            {/if}
  • Add the following line to the end of the configureproduct.tpl file, directly before the <script>recalctotals();</script>:
    <script>$("#inputHostname").val("vpssrv-{$smarty.now}-"+((new Date()).getMonth()+1).toString()+(new Date()).getDate()+parseInt(Math .random()*(999+1),10)+".us.vpsdemo.us");</script>
    <script>
      recalctotals();
    </script>
  • Save the configureproduct.tpl file.

Conclusion

You now know how to customize WHMCS order form cart template for use with VPS Reseller WHMCS module.

  • 0 Users Found This Useful
Was this answer helpful?

Related Articles

Install VPS Reseller WHMCS Module

Please follow the below guidelines to install VPS Reseller WHMCS module. Prerequisites WHMCS...

Create VPS Reseller Product in WHMCS

This article provides a guide for how to create VPS Reseller product in WHMCS. Prerequisites...

Create Custom VPS Reseller Welcome Email

This article provides a guide for how to create custom VPS Reseller Welcome Email in WHMCS....

Optional Configurable Options

This article provides a guide for how to configure optional configurable options for use with VPS...

Create Operating System Selection Via Product Configurable Options

This article provides a guide for how to create Operating System selection via product...