template cookbook

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 1:
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 Name
$11.99 $9.99 On Sale!

Product Alternate Price - Example 2
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 Name
$11.99 $9.99 On Sale!
Can$15.93 Can$13.64

Product Quantity Pricing - Example 3
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 Name
Quantity 1 - 12 13 +
Price $4.00 $3.50
On Sale! $3.75 $3.25
Quantity

Product Variable Price - Example 4
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.

Product Name
Price: $
Return To: Product Template Home Page

Top Template Tips

New v11 SP1 Template Tags Check out the new template tags available in ShopSite version 11 SP1. Custom Cart - No Template Get your own custom shopping cart look without learning how to create a shopping cart template. Quick & Easy Templates Copy and paste ready-made tables into your design to quickly create your own custom templates. Divided Customer Text-Entry Create multiple text fields for your customers to enter in product specific information. Multi-Add-To-Cart Template Setup a form where customers can add multiple items to the cart at the same time. View More Most Popular

Custom Template Forum

Check out the Custom Template Forum in the list of ShopSite User Forums. This forum is specifically for template questions and is monitored by two designers and is frequently viewed by other companies and designers. Post questions about custom templates and post unique tricks you have done with your custom templates.

Custom Template Forum
© 2012 ShopSite, Inc.|ShopSite Shopping Cart Software|Questions?|Site Map