Qboxmail
Solutions

How to customize WHMCS order form template

Giulia Perdomini
15/07/2022
whmcs order template customization

Qboxmail’s module for WHMCS allows you to sell Qboxmail email accounts to your customers directly from your WHMCS. This will make it easier for your customers to bundle a Professional Cloud Email service with their domain or web space.

This guide will help you personalize your orders’ templates so that the mailboxes’ desired price will be shown during the order procedure.

It is necessary to make this modification because if you have set some configurable options (the prices of which vary depending on the mailbox dimension, or the pan chosen by the customer) you have to set the product’s price to zero. This is the price the customer will see first: the prices of the single options are visible only after having chosen the product.

In this case you shouldn’t alter the price filed on the product edit page, because it would be added to the chosen option’s price, creating a wrong final price.

It is however possible to modify the order template (the one seen by the customer), in order to visualize the actual minimum price of your product.

Template modification

On your WHMCS server, you can find the template files in the following directory:

/[WHMCS_installdir]/templates/orderforms/

Every template has its own subfolder, where you can find a “products.tpl” file.

In the majority of these files there is a reference to the minimum price of the product, however, how this value is referenced varies from template to template.

After choosing a template, you will have to find the lines of code responsible for the visualization of the minimum price per month. On the default templates the variable in question is usually called $product.pricing.minprice.price or $product.pricing.minprice.cycleText.

You can modify this part, inserting an if condition: given a product id, if the minimum price per month is zero, print a string containing the actual minimum price.

After this change is made, in case of a later modification of the prices, you will have to modify both the template code and the price filed on WHMCS website.

An example

We took the “premium_comparison” template as an example.

We modified its “products.tpl” file as shown:

Replace this:

{$product.pricing.minprice.cycleText}

with this:

{if $product.pid eq 1} <!-- replace 1 with your product id -->

     {str_replace("$0.00", "$10.00", $product.pricing.minprice.cycleText)}
   <!-- replace $10.00 with the actual price -->

{else}

     {$product.pricing.minprice.cycleText}

{/if}

In this example we used “1” as product id, and “0.00” as the minimum price.

You can find a product’s id via WHMCS:

System settings > products/services

from here you can see the product id by clicking or moving your cursor on the product edit button, (in our example id=1).

We use cookies to provide you a better browsing experience, by continuing you accept their use. For more information visit the Privacy policy page.

Accept