TEMPLATE INSTRUCTIONS FOR closedShop 2.2
With the advent of version 1.6 of closedShop,
you can use templates to totally customize
the Display of items and the diplay of
categories. You can even use programming inside
the template to achieve any need you have
When you use templates, they will replace
the header and footer files normally used.
To use templates, just enter in the name
of the file you want to use as a template
in the Change Variables section in the
Admin program
INSTRUCTIONS FOR INDIVIDUAL ITEM DISPLAY
The simplest way to use the templates is
to insert different data about the item.
To do this, use a special tag like the
following
<# name #>
that tag will be replaced by name of the item
The following tags are availabe
Item id -- <# id #>
Item name -- <# name #>
Item price -- <# price #>
Item shipping price -- <# shipping #>
Item description -- <# description #>
Quantity left -- <# quantity #>
Category name -- <# category #>
Attributes -- <# attributes #> (NOT CURRENTLY IMPLEMENTED)
Image URL -- <# image_url #>
Category URL -- <# cat_url #>
URL to add item to the cart -- <# add_url #>
URL to add item to wishlist -- <# wish_url #>
Begginning of form data needed
to use a POST to add the item to the cart -- <# add_formpost #>
In addition, you can use Perl Code within the template and it
will be evaluated. If there is an error in your Perl Code
it will be displayed on the screen, along with the line
Example:
<# { for (my $k = 0l $k < 50; $k++) { print $k . "
"; } } #>
Note: The code is to be bracketed on both side. Make sure
there is only one space between the # and the {
The variables that you are able to use for items when you
use the Perl code are as follows
Item Code: $code
Item Category: $category
Item Name: $name
Item Price: $price
Quantity Left: $qty
Description: $desc
So for example, if you wanted to have a special message
appear if quantity drops below 5, then you would do the following
(If you have problems with multiple lines, put it all the code on one line)
<# {
if ($quantity < 5) {
print "You must buy $name now!!!";
}
else {
print "You can wait awhile until you buy $name";
}
} #>
INSTRUCTIONS FOR CATEGORY TEMPLATE
The category template follows the same format as the
item template, but there are different variables.
The following tags are available:
Category -- <# category #>
Category Introduction text -- <# intro #>
Category URL -- <# cat_url #>
Category Code -- <# cat_code #>
The programming lets you have some more options
and is a little more complicated
The variables you can use are:
Category Name: $category
Item Hash: %items
The Item hash has all the items of the category
inside of it. Each spot in the hash is actually
an array of the data from an item
So...
To output all the items in a list:
<# {
foreach (keys %items) {
my ($id,$name,$price,$quantity,$itemurl,$imageurl) = split(/~#~/,$items{$_});
print "