Zen Cart Logo
Forums / Templates, Stylesheets, Page Layout / Category descriptions on the main page?

Category descriptions on the main page?

Views: 4,818

Results 1 to 12 of 12
8 Feb 2007, 6:42 AM
#1
mpayson avatar

mpayson

New Zenner

Join Date:
Jun 2006
Posts:
21
Plugin Contributions:
0

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:

[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:

[deleted] . $categories->fields['categories_name'] . '</a><br />' . $current_categories_description);

and then:

[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!

8 Feb 2007, 7:47 AM
#2
bunyip avatar

bunyip

Totally Zenned

Join Date:
Sep 2004
Location:
Western Massachusetts
Posts:
2,361
Plugin Contributions:
1

Re: Category descriptions on the main page?

in your modules/your_template/category_row.php file, find this 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:

    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...

8 Feb 2007, 7:54 AM
#3
mpayson avatar

mpayson

New Zenner

Join Date:
Jun 2006
Posts:
21
Plugin Contributions:
0

Re: Category descriptions on the main page?

Thanks, that was exactly what I needed.

6 Feb 2008, 8:09 PM
#4
gearstudios avatar

gearstudios

New Zenner

Join Date:
Sep 2005
Posts:
88
Plugin Contributions:
0

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:

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

Zen-Cart, The Greatest Shopping Cart!

24 Feb 2008, 5:04 AM
#5
avarshav avatar

avarshav

New Zenner

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

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?


"I'm ready for the weekend, dude."

www.theclassicarchives.com

25 Feb 2011, 6:20 PM
#7
shazam_1973 avatar

shazam_1973

New Zenner

Join Date:
Feb 2011
Posts:
4
Plugin Contributions:
0

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

25 Feb 2011, 7:04 PM
#8
rbarbour avatar

rbarbour

Totally Zenned

Join Date:
Feb 2010
Posts:
2,159
Plugin Contributions:
10

Re: Category descriptions on the main page?

shazam_1973:

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

25 Feb 2011, 7:53 PM
#9
gjh42 avatar

gjh42

Black Belt

Join Date:
Jul 2005
Location:
Upstate NY
Posts:
21,876
Plugin Contributions:
8

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&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:)

11 Mar 2011, 6:25 PM
#10
tkpope avatar

tkpope

New Zenner

Join Date:
Jul 2009
Posts:
37
Plugin Contributions:
0

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/screw-machine-products

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

http://fixyourprofile.com/fasteners/screw-machine-products/ball-studs-and-receptacles/ball-studs

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

Thanks in advance!

11 Mar 2011, 8:58 PM
#11
ian avatar

ian

New Zenner

Join Date:
Nov 2003
Location:
Brisbane , Australia
Posts:
44
Plugin Contributions:
0

Re: Category descriptions on the main page?

hello
How do i get the categories not to be displayed on the centre of the main page?

Ian