Results 1 to 6 of 6
  1. #1
    Join Date
    Sep 2005
    Location
    Waikato, New Zealand
    Posts
    1,539
    Plugin Contributions
    3

    Default Display Category Description below category Title on the Product page

    ZenCart 1.3.7

    Hi All

    What I want to do is to display the Category Description on the Products page (I already have it on the categories page), but I cannot seem to get it to work

    I have located where I want it to display, below this section of code

    /includes/templates/my_templat/templates/tpl_product_info_display.php

    Code:
    <!--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 } ?>
    <!--eof Category Icon -->
    I have found the code that displays the Categories description on the categories page
    /includes/templates/my_templat/templates/tpl_index_categories.php

    Code:
    <?php
    // categories_description
        if ($current_categories_description != '') {
    ?>
    <div id="categoryDescription" class="catDescContent"><?php echo $current_categories_description;  ?></div>
    <?php } // categories_description ?>
    However adding this code to the products page does nothing,

    Code:
    <!--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 } ?>
    <!--eof Category Icon -->
    
    <!--added nigel -->
    <?php
    // categories_description
        if ($current_categories_description != '') {
    ?>
    <div id="indexProductListCatDescription" class="content"><?php echo $current_categories_description;  ?></div>
    <?php } // categories_description ?>
    <!--end nigel -->
    obviously i am missing the code that gets the Value of $current_Categories_description, It seems to be on the
    /includes/modules/pages/index/main_template_vars.php

    Code:
    $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'];
    }
    page however i can't see where this is being called on the categories page (so i can copy the call to the products page)

    What is frustrating is that I can access the $current_category_id and I realise i could use this to get the description by cutting and pasting the above function to the products page, however I am sure that there should be an inbuilt function call thingie

    Any help would be greatly appreciated

  2. #2
    Join Date
    Sep 2003
    Location
    Ohio
    Posts
    69,402
    Plugin Contributions
    6

    Default Re: Display Category Description below category Title on the Product page

    If you add this code to the tpl_product_info_display.php in your templates and overrides you should be able to manipulate the categories_description ...
    Code:
    <?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 ?>
    The first part is getting it and the second part is the display ...
    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: v1.5.5]
    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!

  3. #3
    Join Date
    Sep 2005
    Location
    Waikato, New Zealand
    Posts
    1,539
    Plugin Contributions
    3

    Default Re: Display Category Description below category Title on the Product page

    Thanks for that, It works perfectly

  4. #4
    Join Date
    Sep 2003
    Location
    Ohio
    Posts
    69,402
    Plugin Contributions
    6

    Default Re: Display Category Description below category Title on the Product page

    Thanks for the update that you were able to get this code for displaying the categories_description on your product info pages show ...
    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: v1.5.5]
    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!

  5. #5
    Join Date
    Apr 2007
    Posts
    38
    Plugin Contributions
    0

    Default Re: Display Category Description below category Title on the Product page

    This is fantastic! I have a client who wants the category description to display for each product as normal, but occasionally wants one product to have its own description. I chnages the code a little, to make this happen:
    PHP Code:

    <?php
    //////////////////////////////////////////////////////////////////////
    // display category description if there is no product description  //
    //////////////////////////////////////////////////////////////////////

    $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');

    //echo $sql;

    $categories_description_lookup $db->Execute($sql);
    if (
    $categories_description_lookup->RecordCount() > 0) {
      
    $current_categories_description $categories_description_lookup->fields['categories_description'];
    }
    ?>


    <?php if ($products_description != '') { ?>
    <!--bof Product description -->
    <div id="productDescription" class="productGeneral biggerText"><?php echo stripslashes($products_description); ?></div>
    <!--eof Product description -->
    <?php } else { 
    // categories_description
        
    if ($current_categories_description != '') {
    ?>
    <!--bof Categories description -->
    <div id="indexProductListCatDescription" class="content"><?php echo $current_categories_description;  ?></div>
    <!--eof Categories description -->
    <?php // categories_description 
    ?>
    Maybe it will come in helpful for someone? Sure, you could just copy and paste the category description into the product description, but then if the category description was to change, you would have to update it in each product - this way you don't!!

    Cheers,
    Pat

  6. #6
    Join Date
    Jul 2005
    Location
    Upstate NY
    Posts
    22,010
    Plugin Contributions
    25

    Default Re: Display Category Description below category Title on the Product page

    Nice tweak! :)

    And if you really didn't want any description for a particular product, you could make its description

    &nbsp;

    (non-breaking space) so the description content would not be null.
    Last edited by gjh42; 4 Sep 2009 at 02:09 PM.

 

 

Similar Threads

  1. v151 Display Category Description below category Title on the Product page
    By Alexander81 in forum General Questions
    Replies: 11
    Last Post: 13 Apr 2013, 12:13 AM
  2. Replies: 13
    Last Post: 2 Nov 2010, 06:25 PM
  3. Moving Category Description below category images
    By Funkhouserjm in forum Templates, Stylesheets, Page Layout
    Replies: 7
    Last Post: 26 Apr 2010, 02:35 AM
  4. I want to hide the (category) title just below my nav tabs.
    By jessicasin in forum Templates, Stylesheets, Page Layout
    Replies: 15
    Last Post: 21 Dec 2009, 03:06 AM
  5. Can the Category Description be moved below the product pics?
    By kidzcomfort in forum Setting Up Categories, Products, Attributes
    Replies: 6
    Last Post: 3 Aug 2008, 02:15 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg
Zen-Cart, Internet Selling Services, Klamath Falls, OR