For example, say an organisation certified individual products you sell and had a page on their site and a certification image for each of these products, you could use Template Variables to show this rather than adding database fields and stopping you from being able to easily upgrade Viper Cart.
To use, just paste and change some of the following examples into the product templates.
If Empty for Product
The following statement allows you to only show something if something has been entered for a particular variable for a product.
CODE
<?
if (!empty($Variables['test'])) {
?>
TEXT HERE
<?
}
?>
if (!empty($Variables['test'])) {
?>
TEXT HERE
<?
}
?>
If and Else
The following statement allows you to say if a value is one thing, show this and else.
CODE
<?
if (isset($Variables['test']) && $Variables['test'] == "Gold") {
?>
TEXT HERE
<?
} elseif (isset($Variables['test']) && $Variables['test'] == "Silver") {
?>
TEXT HERE
<?
} else {
?>
TEXT HERE
<?
}
?>
if (isset($Variables['test']) && $Variables['test'] == "Gold") {
?>
TEXT HERE
<?
} elseif (isset($Variables['test']) && $Variables['test'] == "Silver") {
?>
TEXT HERE
<?
} else {
?>
TEXT HERE
<?
}
?>
Show Value
The following just prints the value of a template variable for that product. Make sure you surround it with an if statement to avoid undefined errors.
CODE
<?=$Variables['test']?>
Sign In »
Register Now!
Help


Back to top








