Displaying a Category Description on a Product Page in Zen Cart
Saturday, July 26th, 2008Zen Cart shows the category description on the product list page by default. There are times where you may want to display the category description on the product detail page. Here’s how:
1. Download and open includes/templates/template_default/templates/tpl_product_info_display.php
2. Add the code below where you would like the description to appear:
<!–show category description on product info page–>
<?php
$current_categories_description = “”;
// categories_description
$sql = “SELECT categories_description
FROM ” . TABLE_CATEGORIES_DESCRIPTION . ”
WHERE categories_id= :categoriesID
AND language_id = :languagesID”;
$sql = $db->bindVars($sql, ‘:categoriesID’, $current_category_id, ‘integer’);
$sql = $db->bindVars($sql, ‘:languagesID’, $_SESSION['languages_id'], ‘integer’);
$categories_description_lookup = $db->Execute($sql);
if ($categories_description_lookup->RecordCount() > 0) {
$current_categories_description = $categories_description_lookup->fields['categories_description'];
}
?>
<?php echo $current_categories_description; ?>
<br />
<!–end show descriptions–>
3. Save and upload the file to includes/templates/YourCustomTemplate/templates/tpl_product_info_display.php
As a tip, this can be used to add additional keyword rich text to your product pages.
