HostModules Docs

Template Files

HmSingleOrderAddon is powered by Smarty template files located in templates/orderforms/HmSingleOrderForm/. This page describes what each template renders and the key variables available.

Template Directory

File Structure
HmSingleOrderForm/
├── checkout.tpl          ← Outer wrapper (HTML, head, body)
├── products.tpl          ← Product & billing cycle selection
├── viewcart.tpl          ← Order summary / cart
├── configureproduct.tpl  ← Configurable options
├── configuredomains.tpl  ← Domain register/transfer/use existing
├── complete.tpl          ← Order confirmation
└── error.tpl             ← Error display

checkout.tpl

The outer wrapper template. It renders the <html>, <head>, <body> skeleton and includes the header, footer, and all WHMCS JavaScript files.

Key variables:

VariableDescription
{$company_name}Your WHMCS company name
{$logo_url}Company logo URL
{$charset}Page charset
{$WEB_ROOT}WHMCS URL root
{$template}Template directory name

This is the best template to edit for:

  • Adding custom <head> tags (analytics scripts, fonts)
  • Changing the header HTML
  • Adding a footer

products.tpl

Renders the product information and billing cycle selector.

Key variables:

VariableDescription
{$product.name}Product name
{$product.description}Product description HTML
{$product.pricing}Array of billing cycles with prices
{$billingcycle}Currently selected billing cycle
{$promosavings}Promo savings amount (if promo applied)

configureproduct.tpl

Renders the configurable options panel.

Key variables:

VariableDescription
{$configoptions}Array of configurable option groups
{$customfields}Array of product custom fields

Each $configoptions item has:

  • optionname — the option group label
  • options — array of choices with name and rawprice

configuredomains.tpl

Renders the domain section (register / transfer / use-existing tabs).

Key variables:

VariableDescription
{$domains}Current domain selection state
{$enabledomainsearch}Whether domain search is enabled
{$domainregperiods}Available registration periods
{$tlds}Array of available TLDs
{$domainpricing}TLD pricing array

viewcart.tpl

Renders the order summary/cart section.

Key variables:

VariableDescription
{$cartitems}Array of items in the cart
{$subtotal}Subtotal before tax/discount
{$discount}Discount amount
{$tax}Tax amount
{$total}Total due
{$gateways}Array of available payment gateways

complete.tpl

Shown after a successful order.

Key variables:

VariableDescription
{$orderid}The new order ID
{$invoiceid}Generated invoice ID
{$ispaid}Whether the order was paid immediately
{$clientarea}Client area URL

error.tpl

Shown when an error occurs during checkout.

Key variables:

VariableDescription
{$errormessage}The error message to display

Editing Templates Safely

Templates are overwritten on update

Template files in HmSingleOrderForm/ are replaced when you update the addon. If you edit templates, keep a diff/backup of your changes so you can re-apply them after each update.

Best practice workflow:

  1. Keep your template changes in a version-controlled branch
  2. After each update, run git diff to see what changed in the core templates
  3. Merge your customizations with the new template code

For small styling changes, prefer SCSS Variables or _custom.scss which are safer to maintain.