Category Template Setup

The category page template is different than the other templates. Most templates are basically a static page which has substitution tags in them that the cart substitutes when it displays the page. The category page however does not display as a straight top to bottom page, but rather has cells in a table that can be defined. The cells can be any number across and any number down. Thus the template for the category page uses a number of definitions to set it up.

The definitions are:
$start
$table
$cell
$cell2
$line
$end
$footer

Each of these will be described so you will be able to totally customize this page. Each definition must be enclosed within paranthesis, but otherwise can be on multiple lines. Any line that starts with a # will be treated as a comment line.

$start

The $start variable tells the system what goes at the top of the page. This is usually the standard header that you have for the other pages, and the tag of %%header%% tells the cart to put the standard header there. If you wish to have additional information at the top, it can be added in addition to the %%header%%, or in place of it. One tag that is useful here is the %%category%% and %%categoryplus%% tags which will print the category that was selected for this display at the point it is inserted into the text. A typical $start definition would be:

$start=(%%header%%)

$table

The table defines the table tag that will be used for the category table. A typical table tag is:

$table=(<table width=100% border=0>)

or

$table=(<table width=100% border=1>)

The first one will display a table without borders, and the second one will display a table with a border.

$cell and $cell2

The $cell and $cell2 allow you to define what you want displayed in the cells of the table. Normally the display will be in a table in which $cell will be directly above $cell2. The positions and number of these cells across is defined in the $line definition below.

A typical $cell may contain:

$cell=(<td align=center valign=bottom>%%image%%</td>)

The td means that this is a table data cell, and the /td means that this is the end of that cell.

The image can be made a click on by putting it inside of a link tag like this:

$cell=(<a href="cart.cgi?store=%%store%%&cart_id=%%cart_id%%&product_name=%%nameplus%%&return_page=%%return%%&user-id=%%user-id%%&password=%%password%%&exchange=%%exchange%%&exact_match=exact"><td align=center valign=bottom>%%image%%</td>)

$cell2 will typically be a link, and can contain the name of the item, price, and so forth. A typcial $cell2 would be:

$cell2=(<td align=center>%%name%%<br>%%price%%<br> <a href="cart.cgi?store=%%store%%&cart_id=%%cart_id%%&product_name=%%nameplus%%&return_page=%%return%%&user-id=%%user-id%%&password=%%password%%&exchange=%%exchange%%&exact_match=exact"> More Information</a></td>\n)

If you add a category=%%categoryplus%% to this string, or the link in the $cell, then when continue shopping is clicked in the cart, the customer will be returned to the category page instead of the front page of the cart. The %%categoryplus%% tag is the category with "+" substituted in place of any spaces so it will work properly in a link

For example:

$cell2=(<td align=center>%%name%%<br>%%price%%<br> <a href="cart.cgi?store=%%store%%&cart_id=%%cart_id%%&product_name=%%nameplus%%&category=%%categoryplus%%&user-id=%%user-id%%&password=%%password%%&exchange=%%exchange%%&exact_match=exact">M More Information</a></td>\n)

You will notice that the return_page was replaced with the category since the return_page would override this, and make the category return non-functional.

$line

The line instructs the cart how to display the cells in the table. It will display once for each product. A typical $line would be:

$line=(<tr>%%cell%% %%cell%% %%cell%%</tr>
<tr>%%cell2%% %%cell2%% %%cell2%%</tr>)

The <tr> indicates the beginning of a new line of cells across the page, and the </tr> indicated the end of this new line of cells. The %%cell%% tag takes the above $cell definition and inserts it there for that specific item, and the %%cell2%% inserts the $cell2 definition. Thus the above definition will create two lines with 3 cells each, and the first line will display the cell according to the cell definition, and the second line will display the cell according to the cell2 definition.

$end

The $end will display after all the cells have been displayed. This is where you will need to close any tables that were opened with the $table definition above. This is also a logical place to put a checkout button as well. A typical $end would be:

$end=(<<tr></table><center><b><a href=cart.cgi?store=%%store%%&checkout_button.x=yes&cart_id=%%cart_id%%&return_page=%%return%%&user-id=%%user-id%%&password=%%password%%&exchange=%%exchange%%>Checkout</b></a>)

Note that this end statement will be followed by a line to select the next batch of items if all could not be displayed on this page automatically.

$footer

The $footer is what will display at the bottom of the page, under any line for selecting the next set of items. Normally it is simply the tag %%footer%% which will insert your standard store footer that displays on your other pages. Like the $header though, you can add additional text to the %%footer%% tag, or replace it entirely. If you replace it entirely, be sure to close any tables that you opened in the $header above.