Forums / Templates, Stylesheets, Page Layout / Show Category description on Product info pages

Show Category description on Product info pages

Locked

Views: 4,197

Results 1 to 7 of 7
This thread is locked. New replies are disabled.
15 Nov 2007, 10:22 PM
#1
commsman avatar

commsman

New Zenner

Join Date:
Nov 2007
Posts:
1
Plugin Contributions:
0

Show Category description on Product info pages

I need to display the category description text (but not the category image) at the top of the Product Information pages.
I can do this for the Product Listing pages but cannot see how to do it for the Product Detail pages.
Hope someone has the answer to this.
Cheers
J

15 Nov 2007, 11:43 PM
#2
kuroi avatar

kuroi

Totally Zenned

Join Date:
Apr 2006
Location:
London, UK
Posts:
10,475
Plugin Contributions:
11

Re: Show Category description on Product info pages

You would have to add a database query into the main_template_vars.php pages module for product_info to extract the category description for the page's current language. And then add some further custom code into the tpl_product_info_display.php template to display the result of that database query.

If you are using additional product types that have their own product_info-equivalent pages, you would need to repeat the above changes for each of them.

Kuroi Web Design and Development | Twitter

(Questions answered in the forum only - so that any forum member can benefit - not by personal message)

6 Apr 2008, 6:56 PM
#3
spoma avatar

spoma

New Zenner

Join Date:
Feb 2008
Posts:
12
Plugin Contributions:
0

Re: Show Category description on Product info pages

I am having this same problem. Could someone give a little more detail into what needs to be done here?

6 Apr 2008, 10:43 PM
#4
kuroi avatar

kuroi

Totally Zenned

Join Date:
Apr 2006
Location:
London, UK
Posts:
10,475
Plugin Contributions:
11

Re: Show Category description on Product info pages

Upon reflection, there's an easier way to do this. Just insert the following where you want this description to appear

<p><?php echo zen_get_category_description(zen_get_products_category_id((int)$_GET['products_id']), (int)$_SESSION['languages_id']) ?></p>

Kuroi Web Design and Development | Twitter

(Questions answered in the forum only - so that any forum member can benefit - not by personal message)

8 Apr 2008, 5:37 PM
#5
spoma avatar

spoma

New Zenner

Join Date:
Feb 2008
Posts:
12
Plugin Contributions:
0

Re: Show Category description on Product info pages

That worked! Thanks for the help.

28 Apr 2008, 8:11 PM
#6
spinnywoman avatar

spinnywoman

Zen Follower

Join Date:
Jul 2004
Location:
Oxford
Posts:
101
Plugin Contributions:
0

Re: Show Category description on Product info pages

Thanks for this post. Works a treat!

Ruth

25 Jan 2010, 5:14 PM
#7
sivivatu avatar

sivivatu

New Zenner

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

Re: Show Category description on Product info pages

http://www.ksbrands.co.uk/zen/index.php?main_page=product_info&cPath=27&products_id=486

I'm tryin to get the Category description in the white space underneath the header but can't figure out why it's not working. Any help would be appreciated. Thanks

Here's the code that I am using:

<!--bof Category Icon -->
<?php if ($module_show_categories != 0) {?>
<?php
/**
 * display the category icons
 */
require($template->get_template_dir('/tpl_modules_category_icon_display.php',DIR_WS_TEMPLATE, $current_page_base,'templates'). '/tpl_modules_category_icon_display.php'); ?>
<?php } ?>




<?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
// categories_description
    if ($current_categories_description != '') {
?>
<div id="indexProductListCatDescription" class="content"><?php echo $current_categories_description;  ?></div>
<?php } // categories_description ?>



<!--eof Category Icon -->