Product Template Examples
Name, SKU, and Description
Price
Graphic
Ordering Options
Buttons
Subproducts
More Info Pages
Complete Example

Custom Product Templates: Product Price

Product price can be a very simple or complex piece of custom template code. If you are developing a template for just one store and you know the requirements of that store, you can probably use simple code, such as Example 1, below. If you are designing a generic template and/or if your template needs to handle a second currency, quantity pricing, or variable pricing, your template will be more complex. Some of the options that you need to consider are:

Product Price Example Resulting Page

This example displays the product name and then the price and sale price, depending on which fields the merchant set to display. Because there are two fields that must be set before a sale price can be displayed, the template uses a variable to track if both conditions are met, and avoids unnecessarily nested IF statements. The [-- Store.OnSale --] tag returns the text or HTML defined for the "On Sale!" field.

Product Alternate Price Example Resulting Page

This example is exactly like the first example, with the addition of code for handling a second currency (an alternate price). When a second currency is enabled, ShopSite automatically calculates the alternate price and sale price of each product based on the regular and sale price and a merchant-supplied exchange rate.

Product Quantity Pricing Example Resulting Page

Quantity pricing (a ShopSite Pro feature) is quite different from other types of product pricing, and uses a different set of custom template tags. The quantity pricing information is presented in an HTML table. The merchant can select background colors for the table rows, but you can apply additional formatting by defining attributes for the table.qpheader element in a CSS style sheet.

Quantity pricing requires customers to be able to enter the quantity that they want to order, so your template must also display the product quantity input box. An input box requires an HTML form, so instead of a simple Add to Cart link, your template must have a form submit button.

Because quantity pricing and other pricing options are so different, it's best to use an IF tag to test for quantity pricing, and then have two separate paths through the code. Although the merchant can enter values for regular pricing, quantity pricing, and variable pricing, they are mutually exclusive and quantity pricing take priority.

Product Variable Price Example Resulting Page

Variable pricing (a ShopSite Pro feature) overrides regular pricing when enabled. Because customers can enter the price that they want to pay for the product, your template must use an HTML form and a submit button instead of an Add to Cart link. If the merchant has enabled variable price for a product, variable name and/or variable SKU can also be enabled. This example code looks for all three, and the five products in the sample data have various combinations of fixed and variable values.