Home > The Template System > Product and Sale Unit Templates

Table of Contents

DotAdmin User Guide

Product and Sale Unit Templates

In the Store section of the dotAdmin system, each page is used to display information about a product. This requires three templates: An outer page template, which contains a product template, which in turn contains a sale unit template. Below is a diagram showing the function of each template:

Product Page Template
A product page, showing the Product Template (light grey), and Sale Unit template (darker grey).

Note that in the example above the {content} blocks are being output by the product template, rather than the page template. This is because the content placeholder in store pages is used to include the product, and the product itself is treated as the owner of the actual content blocks (the product template has its own {content} placeholders). The sale unit template is also contained within the product template, providing pricing information and add-to-cart buttons.

Product Templates

Product templates are very much like page templates and can contain all the placeholders available to page templates, plus a couple of product-specific placeholders. Below is a list of placeholders specifically for use within product templates.

Placeholder Output
{large_image} Full path and filename of the product large image.
{large_image_width} Width in pixels of the product large image for use in image tag attributes.
{large_image_height} Height in pixels of the product large image for use in image tag attributes.
{sale_units} Replaced with the output from a sale unit template, to include pricing information and add-to-cart buttons.

Sale Unit Templates

Included in a product template using the {sale_units} placeholder, a sale unit template provides the mechanism for visitors to add products to the shopping cart. Sale unit information can be passed to the cart either by appending parameters to the query string in a link, or by using a form with hidden fields.

The shopping cart requires two pieces of data to add a sale unit to the visitor's order; a product code, and a quantity. Two further parameters; ‘rz’ and ‘rp’ can also be added. These carry the referring zone and page, allowing the cart to return the customer to the product page when she is finished with the cart.

<a href="/content/cart/?product_code={id}&amp;quantity=1
  &amp;rz={zone}&amp;rp={product_id}">
  Add to Cart
</a>

<!-- Or, alternatively... -->

<form method="POST" action="/content/cart/">
  <input type="hidden" name="product_code" value="{id}" />
  <input type="hidden" name="quantity" value="1" />
  <input type="hidden" name="rz" value="{zone}" />
  <input type="hidden" name="rp" value="{product_id}" />
  <input type="submit" name="send" value="Add to Cart" />
</form>

Passing parameters to the shopping cart from a sale unit template.

Because a product may have multiple sale units associated with it, the sale unit placeholders are enclosed within a repeatable block, named BLOCK {sale_units}.

<table>
<!-- BLOCK {sale_units} -->

<form method="POST" action="/content/cart/">

  <input type="hidden" name="product_code" value="{id}" />
  <input type="hidden" name="quantity" value="1" />
  <input type="hidden" name="rz" value="{zone}" />
  <input type="hidden" name="rp" value="{product_id}" />

  <tr>
    <td>
      {title}: <b>£{price}</b>
    </td>
    <td>
      <input type="submit" name="send" value="Add to Cart"
    </td>
  </tr>

</form>

<!-- /BLOCK {sale_units} -->
</table>

A simple sale unit template.

The sale_units block can contain one other block, named BLOCK {back_order}. This block is only displayed if the sale unit is out of stock and back-ordering is enabled for this product. This block can be used to display either a message to inform the visitor, and/or show a lead time to re-order the stock (if known).

<table>
<!-- BLOCK {sale_units} -->

  ...

  <!-- BLOCK {back_order} -->
    <p>This product is currently out of stock

    <!-- IF {lead_time} -->
      and delivery will take approximately {lead_time} days.</p>
    <!-- /IF {lead_time} -->
    <!-- ELSE -->
      and may cause your order to be delayed.</p>
    <!-- /ELSE -->

  <!-- /BLOCK {back_order} -->

<!-- /BLOCK {sale_units} -->
</table>

Displaying a back-order warning to the visitor.

The complete list of sale unit placeholders below includes some we have not covered above.

Placeholder Output
BLOCK {sale_units} Block which repeats to show price information and cart links for each sale unit.
BLOCK {back_order} Used to display a stock warning to the customer if a product is out of stock.
{id} The ID (product code) of this sale unit.
{title} The sale unit title.
{price} The price of this sale unit.
{price_inc} The price of the sale unit, inclusive of tax if the shipping location is known.
{zone} The visitor's current zone. Used as a value for ‘rz’ to refer the visitor back from the shopping cart.
{product_id} ID (url) of the current product. Used as a value for ‘rp’ to refer the visitor back from the shopping cart.
{lead_time} BLOCK back_order only: The expected delivery delay, in days, for an out of stock item.
{u_def_<0 to 9>} Outputs values of user defined sale unit variables, if set. For example: {u_def_0}, {u_def_1}, etc. Mostly used for expressing variations between sale units; colour variations, sizes, and so on.