Screen: ShopSite > Merchandising > Custom Templates
Most global tags can be used in any type of custom template.
With the optional PROCESS parameter, any custom template tags in contents of filename are replaced with their database values before the contents are placed into the output file.
[-- VAR.t2 PAGE.Text2 --]
You could later retrieve that value with this command:
[-- VAR.t2 --]
You can store almost any value in a VAR variable. These two commands store a numeric value and a string value, respectively:
[-- VAR.numcolumns 2 --]
[-- VAR.bargain "Bargain of the day!" --]
If the value stored is numeric, you can increment or decrement the value by 1 with the INC and DEC parameters, like this:
[-- VAR.t2 INC --]
Once a VAR is defined, it's value is available during the rest of the store generation process and can be called from both page and product templates. It can also be used in LOOP and CALL statements, like this:
[-- LOOP PRODUCTS VAR.numcolumns --]
[-- CALL program.cgi VAR.xxxx --]
You can nest [-- IF --] tags, and you can use multiple
Any custom template tags within the conditional content are replaced with information from the pages and products databases before the content is added to the current page.
The following example tests whether the merchant has checked the box to display the page name, and inserts the contents of the PAGE.Name field if it checked:
[-- IF PAGE.DisplayName --]
<H1>[-- PAGE.Name --]</H1>
[-- END_IF --]
This example tests whether the page name matches a string, and inserts the contents of the PAGE.Field1 field if it matches:
[-- IF PAGE.Name "About Us" --]
<H1>[-- PAGE.Field1 --]</H1>
[-- END_IF --]
This is a specific IF call you can use to test whether or not to create special URLs for Google Analytics tracking cross-domain links. It will return true if Google Analytics is enabled and either the shopping cart or secure domain name is different from the store domain name.
For example, if a store were using Google Analytics, and the store used the domain name www.mystore.com, but the shopping cart used www.checkout.com, you would need to make sure links and forms that went from the store pages to the shopping cart pages (such as an Add To Cart button) sent the correct information for Google Analytics.
The following is an example of using this tag for a View Cart button:
[-- IF ANALYTICS_MULTI_DOMAIN --]
<script type="text/javascript" language="JavaScript">
document.write('<a href="javascript:__utmLinker(\'[-- SHOPPING_CART_URL --]\');">View Cart</a>');
</script>
<noscript>
<a href="[-- SHOPPING_CART_URL --]">View Cart</a>
</noscript>
[-- ELSE --]
<a href="[-- SHOPPING_CART_URL --]">View Cart</a>
[-- END_IF --]
You could also use the tag to make sure a FORM tag, such as the search form below, gets handled right:
[-- IF ANALYTICS_MULTI_DOMAIN --]
<form action="[-- SHOPPING_CART_URL BASE --]/productsearch.cgi?storeid=[-- STORE.ID --]" method="post" onSubmit="javascript:__utmLinkPost(this)">
[-- ELSE --]
<form action="[-- SHOPPING_CART_URL BASE --]/productsearch.cgi?storeid=[-- STORE.ID --]" method="post">
[-- END_IF --]
If a CALL tag is used in a page or product template, the user-supplied program must be in the ShopSite CGI directory. If a CALL tag is used in a shopping cart or registration template, the program must be located in the shopping cart directory.
You can include any of the following, which will be substituted before the program is called:
Example:
The above example would call a program called createthumbnail.pl in the ShopSite CGI directory, and pass in the values 20, 20, and a full <img> tag for the graphic of the current product. This program might return an <img> tag to a newly-created 20x20 thumbnail of the product graphic.
When designing custom templates, it can be useful to know what values are being used for specific things. The GENERATE_MESSAGE tag will display a specific message and the value of a VAR, PAGE, or PRODUCT tag on the page generation screen in the back office.
Most store tags can be in all templates, and can be used with the REMOVE_HTML parameter.
With the optional BASE parameter, this tag returns the URL to the shopping cart CGI directory (as set in
Note that if you use this tag in a custom page template (not a product template), you cannot use the
<a href="[--SHOPPING_CART_URL--]"><img src="media/view_cart1.gif"></a>
The default values for these fields are shown here, but the merchant can change the text.
1 Several fields have default values and will never return null, and thus cannot be used in an IF statement. See the page tags and product tags to find the possible values for each field.
|
ShopSite Help and Resource Center Last updated: February 8, 2007 Give Feedback |
![]() © 2008, ShopSite, Inc. ShopSite Shopping Cart Software |