PrintNowPrintNowDocs
Themes

Calculator

Reference for the pricing calculator template used on product and sub-category pages.

The pricing calculator is a component that displays size, color, quantity, options, turnaround time, and pricing on product detail and sub-category pages. Its HTML layout is defined by a template file in your theme's calculator/ folder.

How It Works

  1. A master page specifies the calculator template name in its directive: CalculatorTemplate="default"
  2. This maps to the file calculator/default.html in the active theme
  3. The <pn:Calculator runat="server" /> control renders the calculator using that template
  4. PrintNow's JavaScript populates the calculator with product-specific pricing data

Template File

The default calculator template is located at:

calculator/default.html

This is a large HTML file containing the full calculator UI. It uses a combination of Mustache-like variables and HTML structure that PrintNow's JavaScript binds to for dynamic behavior.

Calculator Sections

The calculator template is organized into these functional sections:

SectionDescription
Size SelectionDropdown or list of available product sizes.
Color SelectionColor/coating options (e.g., Full Color, Black & White).
QuantityQuantity input or dropdown with predefined quantities.
Product OptionsAdditional options like paper stock, finish, folding, etc.
Turnaround TimeProduction time selection affecting pricing.
Pricing TotalsDisplays unit price, subtotal, and total price.
File HandlingUpload, editor, or template selection buttons.
Shipping EstimateOptional shipping cost preview.

CSS Classes

The calculator uses specific CSS classes that PrintNow's JavaScript targets. These classes must be present for the calculator to function:

CSS ClassPurpose
calc-turnaround-rowRow containing turnaround time options. Can be hidden with CSS if not needed.
calc-production-rowRow showing production time details. Can be hidden with CSS.

Customization

To customize the calculator:

  1. Open your theme in the Site Themes editor or via FTP
  2. Navigate to calculator/default.html
  3. Modify the HTML structure and CSS styling
  4. Keep all data-binding attributes and functional CSS classes intact

You can create additional calculator templates by adding new HTML files to the calculator/ folder (e.g., calculator/compact.html) and referencing them in master page directives:

<%@ Master ... CalculatorTemplate="compact" %>

Embedding the Calculator

In master pages, the calculator is placed using the server control:

<div class="calc-container">
    <div class="card-body">
        <pn:Calculator runat="server" />
    </div>
</div>

On the order-options page template, the calculator is injected via a Mustache variable:

{'{{{'} Calculator {'}}}'}
  • Server Controls — The pn:Calculator control that renders the calculator template
  • Master Pages — Where the CalculatorTemplate directive selects which template to load
  • Page Templates — The order-options.mustache template that embeds the calculator

On this page