Forums / Setting Up Categories, Products, Attributes / How can I display the category descriptiong text on the product display info page?

How can I display the category descriptiong text on the product display info page?

Locked

Started by hellmind on 16 Sep 2009, 9:13 PM · Views: 1,542

Results 1 to 2 of 2
This thread is locked. New replies are disabled.
16 Sep 2009, 9:13 PM
#1
hellmind avatar

hellmind

New Zenner

Join Date:
May 2009
Posts:
10
Plugin Contributions:
0

How can I display the category descriptiong text on the product display info page?

If a product is in 2 categories I also want to display both category descriptions on the product display info page

Thank you

18 Sep 2009, 5:43 AM
#2
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: How can I display the category descriptiong text on the product display info page?

You would have to determine what to do with the results, but something like this will grab all of the categories_descriptions for the product for the tpl_product_info_display.php ...

<?php
  $all_categories = "SELECT categories_id from " . TABLE_PRODUCTS_TO_CATEGORIES . " WHERE products_id = '" . (int)$_GET['products_id'] . "'";
  $all_categories = $db->Execute($all_categories);
  $all_categories_description = "";
  while (!$all_categories->EOF) {
  // categories_description
    $sql = "SELECT categories_description
            FROM " . TABLE_CATEGORIES_DESCRIPTION . "
            WHERE categories_id= :categoriesID
            AND language_id = :languagesID";

    $sql = $db->bindVars($sql, ':categoriesID', $all_categories->fields['categories_id'], 'integer');
    $sql = $db->bindVars($sql, ':languagesID', $_SESSION['languages_id'], 'integer');
    $categories_description_lookup = $db->Execute($sql);
    if ($categories_description_lookup->RecordCount() > 0) {
      $all_categories_description .= $categories_description_lookup->fields['categories_description'];
      $all_categories_description .= '<br class="clearBoth" />';
    }
    $all_categories->MoveNext();
  }
  echo $all_categories_description;
?>

Linda McGrath
If you have to think ... you haven't been zenned ...

**Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!**

Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
Officially PayPal-Certified! Just click here

Try our Zen Cart Recommended Services - Hosting, Payment and more ...
Signup for our Announcements Forums to stay up to date on important changes and updates!