Page 1 of 2 12 LastLast
Results 1 to 10 of 12
  1. #1
    Join Date
    Jun 2006
    Posts
    21
    Plugin Contributions
    0

    Default Category descriptions on the main page?

    I have the categories displayed on the main page. In addition to the category name & photo, I'd like to have the category description displayed. Unfortunately, it doesn't seem easy to do this. I edited line 40 of modules/mytemplate/category_row.php to include:

    Code:
    [deleted for legibility] . $categories->fields['categories_name'] . '</a><br />' . $categories->fields['categories_description']);
    But it appears that the field categories_description isn't included in the array from the database results. I found classes/category_tree.php and added cb.categories_description to each of the quesries, but It's still not displaying the description.

    I then dug deeper and tried changing modules/mytemplate/category_row.php to:
    Code:
    [deleted] . $categories->fields['categories_name'] . '</a><br />' . $current_categories_description);
    and then:

    Code:
    [deleted] . $categories->fields['categories_name'] . '</a><br />' . $categories_description_lookup->fields['categories_description']);
    neither of which helped.

    So how do I get the category descriptions on my home page? There must be an easy way that I'm missing.

    Thanks!

  2. #2
    Join Date
    Sep 2004
    Location
    Western Massachusetts
    Posts
    2,945
    Plugin Contributions
    5

    Default Re: Category descriptions on the main page?

    in your modules/your_template/category_row.php file, find this code:
    Code:
        if (!$categories->fields['categories_image']) !$categories->fields['categories_image'] = 'pixel_trans.gif';
        $cPath_new = zen_get_path($categories->fields['categories_id']);
    then insert a line in it so it reads like this:
    Code:
        if (!$categories->fields['categories_image']) !$categories->fields['categories_image'] = 'pixel_trans.gif';
        $categories_description = zen_get_category_description($categories->fields['categories_id'], $_SESSION['languages_id']);
    	$cPath_new = zen_get_path($categories->fields['categories_id']);
    now you can use the variable $categories_description on (what was) line 40 to display it
    Neville
    An assumption is what you arrive at when you get tired of thinking...

  3. #3
    Join Date
    Jun 2006
    Posts
    21
    Plugin Contributions
    0

    Default Re: Category descriptions on the main page?

    Thanks, that was exactly what I needed.

  4. #4
    Join Date
    Sep 2005
    Posts
    95
    Plugin Contributions
    0

    Default Re: Category descriptions on the main page?

    This will also show the subcategory descriptions on subsequent pages. Great tip!!! How to show Category Descriptions.

    In your modules/your_template/category_row.php file, find this code:
    Code:
    Code:
     if (!$categories->fields['categories_image']) !$categories->fields['categories_image'] = 'pixel_trans.gif';
        $cPath_new = zen_get_path($categories->fields['categories_id']);
    then insert a line in it so it reads like this:
    Code:
    Code:
        if (!$categories->fields['categories_image']) !$categories->fields['categories_image'] = 'pixel_trans.gif';
        $categories_description = zen_get_category_description($categories->fields['categories_id'], $_SESSION['languages_id']);
    	$cPath_new = zen_get_path($categories->fields['categories_id']);
    now you can use the variable $categories_description on (what was) line 40 to display it
    Zen-Cart, The Greatest Shopping Cart&#33;

  5. #5
    Join Date
    Feb 2008
    Posts
    24
    Plugin Contributions
    0

    Default Re: Category descriptions on the main page?

    I'm trying to do the same exact thing here, but I don't have this file in this location. I'm using the classic template. When I go into modules/classic there is no category_row.php file. There's just one other file in there.

    In my modules directory, there is a category_row.php file, and when I use the suggestion noted above, it doesn't work. I know the answer is right in front of me, anyone have any ideas?

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

    Default Re: Category descriptions on the main page?

    Copy /includes/modules/category_row.php to /includes/modules/classic/category_row.php and make the edits there.

  7. #7
    Join Date
    Feb 2011
    Posts
    4
    Plugin Contributions
    0

    Default Re: Category descriptions on the main page?

    I'm trying to do something similar (original post) but my php skills are a little rough.

    I want to dynamically create the href for a custom menu on my main page. I think I need to use zen_get_path($current_category_id = '') but I'm not sure how to integrate that into the html. Is there a relatively simple way to do this?

    I know this is totally wrong but perhaps it will illustrate what I am trying to do:

    <a href="<?php zen_get_path($current_category_id = '65')?>" ><img src="/images/t_platters.gif"><br>Platters and Plates</a>

    Not surprisingly this link leads to:
    The requested URL /cPath=65 was not found on this server

  8. #8
    Join Date
    Feb 2010
    Posts
    2,159
    Plugin Contributions
    17

    Default Re: Category descriptions on the main page?

    Quote Originally Posted by shazam_1973 View Post

    I know this is totally wrong but perhaps it will illustrate what I am trying to do:

    <a href="<?php zen_get_path($current_category_id = '65')?>" ><img src="/images/t_platters.gif"><br>Platters and Plates</a>

    Not surprisingly this link leads to:
    [INDENT]The requested URL /cPath=65 was not found on this
    <a href="/index.php?main_page=index&cPath=65"><img src="<?php echo DIR_WS_TEMPLATE ?>images/t_platters.gif" border="0" /></a>

    this will show your category image t_platters.gif with a link to that category - I personally use this example for category images

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

    Default Re: Category descriptions on the main page?

    You are already hardcoding the entire menu, so I see no benefit to calling zen functions here. Just use a straight HTML link.

    <a href="index.php?main_page=index&amp;cPath=65"><img ...

    And you should keep any further discussion of your question (which is off topic for this thread) to your original thread.

    Oops, old tab:)

    And I note that this thread was resurrected three years and one day after its original activity:)
    Last edited by gjh42; 25 Feb 2011 at 08:57 PM.

  10. #10
    Join Date
    Jul 2009
    Posts
    37
    Plugin Contributions
    0

    Default Re: Category descriptions on the main page?

    I have used the above code to get the Category (and Subcategory) descriptions to show on the Category page:

    http://fixyourprofile.com/fasteners/...chine-products

    I would also like to get the Category Description to show on the Product page:

    http://fixyourprofile.com/fasteners/...les/ball-studs

    However, I cannot figure out how to call for $categories_description in tpl_product_info_display.php

    Thanks in advance!

 

 
Page 1 of 2 12 LastLast

Similar Threads

  1. Removing the Category and Sub Category header on the Main page
    By redsy in forum Templates, Stylesheets, Page Layout
    Replies: 3
    Last Post: 14 Jul 2013, 12:43 AM
  2. Category descriptions on Main Page
    By webrob in forum Templates, Stylesheets, Page Layout
    Replies: 9
    Last Post: 13 Mar 2010, 07:22 PM
  3. Category Descriptions on Main Page
    By tomkeyes in forum Templates, Stylesheets, Page Layout
    Replies: 3
    Last Post: 22 Oct 2009, 07:45 PM
  4. Getting sub category images to show up on the main category page
    By VigilantWine in forum Setting Up Categories, Products, Attributes
    Replies: 5
    Last Post: 16 Feb 2009, 09:45 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