Zen Cart Logo
Forums / Templates, Stylesheets, Page Layout / TOP category names. Can they be individual images instead?

TOP category names. Can they be individual images instead?

Locked

Views: 2,745

Results 1 to 16 of 16
This thread is locked. New replies are disabled.
7 Apr 2007, 11:09 PM
#1
askfritzdotcom avatar

askfritzdotcom

New Zenner

Join Date:
Mar 2007
Posts:
24
Plugin Contributions:
0

TOP category names. Can they be individual images instead?

Can I change the top category names to be idivudual images of text instead of just plain text? See this image:

http://208.109.212.191/helpme.jpg

And if not, where at least can I change the link color from 999999 to 0000FF?

7 Apr 2007, 11:34 PM
#2
merlinpa1969 avatar

merlinpa1969

Totally Zenned

Join Date:
Mar 2004
Posts:
13,031
Plugin Contributions:
4

Re: TOP category names. Can they be individual images instead?

I just tried something and it seems to have worked
you will need to change the size of the text field in the database but you can then just use the <img src="your image url here">
you can see this working Here

Zen cart PCI compliant Hosting

8 Apr 2007, 8:56 AM
#3
askfritzdotcom avatar

askfritzdotcom

New Zenner

Join Date:
Mar 2007
Posts:
24
Plugin Contributions:
0

Re: TOP category names. Can they be individual images instead?

I don't really understand what you mean...

8 Apr 2007, 5:44 PM
#4
gjh42 avatar

gjh42

Black Belt

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

Re: TOP category names. Can they be individual images instead?

If you enter a complete image link as the name of a category, the image will show up wherever the cat name is displayed.

...correct, Merlin?

8 Apr 2007, 5:53 PM
#5
merlinpa1969 avatar

merlinpa1969

Totally Zenned

Join Date:
Mar 2004
Posts:
13,031
Plugin Contributions:
4

Re: TOP category names. Can they be individual images instead?

correct, however you will need to modify the cell for the category name and make it bigger than 32

Zen cart PCI compliant Hosting

8 Apr 2007, 6:33 PM
#6
beth_katherine avatar

beth_katherine

Zen Follower

Join Date:
Feb 2007
Posts:
158
Plugin Contributions:
0

Re: TOP category names. Can they be individual images instead?

The question I have is WHERE do I make the addition as it is something that I want to do as well.

While file or is it in the Admin panel?

Beth-Katherine

8 Apr 2007, 7:41 PM
#7
gjh42 avatar

gjh42

Black Belt

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

Re: TOP category names. Can they be individual images instead?

Admin > Catalog > Categories/Products. It's in the product entry/editing page.
Be aware, your category will then be named this html glob, and it will show in the address bar.

8 Apr 2007, 8:43 PM
#8
merlinpa1969 avatar

merlinpa1969

Totally Zenned

Join Date:
Mar 2004
Posts:
13,031
Plugin Contributions:
4

Re: TOP category names. Can they be individual images instead?

in phpmyadmin
open the categories description table,
edit the category name cell and make the number of characters higher

I set the test to 128

then in the admin -> gatalog -> shoose the category you want to use an image for,
then add thei <img src="YOUR IMAGE INFORMATION HERE">

it will now show the category image

Zen cart PCI compliant Hosting

9 Apr 2007, 2:33 AM
#9
askfritzdotcom avatar

askfritzdotcom

New Zenner

Join Date:
Mar 2007
Posts:
24
Plugin Contributions:
0

Re: TOP category names. Can they be individual images instead?

Thank you, Merlin. That worked perfectly. :) Just one small question that ties into that as well...

Is there anyway I can differentiate the image that shows up for the TOP category set and the left SIDEs set so I can have two different styles of links?

EG: Different style links with css: a:link and a.nav:link

Thanks for all the help,
Tom

9 Apr 2007, 11:21 PM
#10
askfritzdotcom avatar

askfritzdotcom

New Zenner

Join Date:
Mar 2007
Posts:
24
Plugin Contributions:
0

Re: TOP category names. Can they be individual images instead?

How do I change the title of the category pages? Now my titles read the location of the images.

Thanks,
Tom

10 Apr 2007, 12:26 AM
#11
gjh42 avatar

gjh42

Black Belt

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

Re: TOP category names. Can they be individual images instead?

That's what I said earlier. The categories are now named the HTML code block. I don't think there is a way to change that without adding to the database and editing php code.

10 Apr 2007, 12:42 AM
#12
gjh42 avatar

gjh42

Black Belt

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

Re: TOP category names. Can they be individual images instead?

I just had a thought. I've been working with altering category menu output recently, and it might be able to be tweaked to do what you want as well.
/includes/templates/your_template/sideboxes/tpl_categories.php assembles the content, and it should be possible to have it insert an img tag in place of the category name. You would use the cat id in the image filename so it could be automatic. I'll look at it and get back.

10 Apr 2007, 3:14 AM
#13
gjh42 avatar

gjh42

Black Belt

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

Re: TOP category names. Can they be individual images instead?

This code is not fully tested, but try it and see. In tpl_categories.php find this block starting around line 31:

     if (zen_get_product_types_to_category($box_categories_array[$i]['path']) == 3 or ($box_categories_array[$i]['top'] != 'true' and SHOW_CATEGORIES_SUBCATEGORIES_ALWAYS != 1)) {
        // skip if this is for the document box (==3)
      } else {
      $content .= '<a class="' . $new_style . '" href="' . zen_href_link(FILENAME_DEFAULT, $box_categories_array[$i]['path']) . '">';
      if ($box_categories_array[$i]['current']) {
        if ($box_categories_array[$i]['has_sub_cat']) {
          $content .= '<span class="category-subs-parent">' . $box_categories_array[$i]['name'] . '</span>';
        } else {
          $content .= '<span class="category-subs-selected">' . $box_categories_array[$i]['name'] . '</span>';
        }
      } else {
        $content .= $box_categories_array[$i]['name'];
      }
``` and add

```php
	  // gjh42 20070409 display images for category names
	$cat_name_display = $box_categories_array[$i]['name'];
	if(in_array(str_replace("cPath=","",$box_categories_array[$i]['path']), explode(",",'3,21,21_57'))) { //replace numbers with your cat ids separated by commas
 	$cat_name_display =  '<img src="' . HTTP_SERVER . DIR_WS_CATALOG . 'images/catimg' . str_replace("cPath=","",$box_categories_array[$i]['path']) . '.gif">';
	 }

and replace $box_categories_array[$i]['name'] with $cat_name_display in three places

to get this:```php
if (zen_get_product_types_to_category($box_categories_array[$i]['path']) == 3 or ($box_categories_array[$i]['top'] != 'true' and SHOW_CATEGORIES_SUBCATEGORIES_ALWAYS != 1)) {
// skip if this is for the document box (==3)
} else {
$content .= '<a class="' . $new_style . '" href="' . zen_href_link(FILENAME_DEFAULT, $box_categories_array[$i]['path']) . '">';
// gjh42 20070409 display images for category names
$cat_name_display = $box_categories_array[$i]['name'];
if(in_array(str_replace("cPath=","",$box_categories_array[$i]['path']), explode(",",'3,21,21_57'))) {
$cat_name_display = '<img src="' . HTTP_SERVER . DIR_WS_CATALOG . 'images/catimg' . str_replace("cPath=","",$box_categories_array[$i]['path']) . '.gif">';
}
if ($box_categories_array[$i]['current']) {
if ($box_categories_array[$i]['has_sub_cat']) {
$content .= '<span class="category-subs-parent">' . $cat_name_display . '</span>';
} else {
$content .= '<span class="category-subs-selected">' . $cat_name_display . '</span>';
}
} else {
$content .= $cat_name_display;
}

This will check whether the category being prepared is on your list, and if so set $cat_name_display to the image source for the respective category. This will be included in the output in place of the text name.

The images should be in the form catimg3.gif or catimg21_57.gif, with the numbers matching the cPath for the category, and located in the main /images/ directory. (It should be possible to substitute DIR_WS_TEMPLATE for DIR_WS_CATALOG and store the images in your template /images/ directory if desired.)

If the present category is not on the list, $cat_name_display will place the text name in its standard position.

The "if (in_array..." test has been proven to work, but the image link building has not been tested in theis implementation.
10 Apr 2007, 3:19 AM
#14
gjh42 avatar

gjh42

Black Belt

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

Re: TOP category names. Can they be individual images instead?

Note: the above code is for the main category box. It will not affect the categories-tabs menu, though the method may be applicable for that case.

6 Jun 2007, 9:01 PM
#15
gjh42 avatar

gjh42

Black Belt

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

Re: TOP category names. Can they be individual images instead?

This function, along with several others, is now available in the Categories Dressing mod in Downloads > Sideboxes.

This is a mix-and-match group of alterations you can make to the appearance of the standard Zen Cart "Categories" sidebox.
Each alteration can be repeated with different characteristics, or omitted if not wanted.

  • You can add dividers and/or non-linked headings in any desired locations.
  • You can add images to these headings.
  • You can replace any desired category names with image links.
  • You can give a desired style to any of these alterations using your stylesheet.
8 Jun 2007, 4:36 PM
#16
askfritzdotcom avatar

askfritzdotcom

New Zenner

Join Date:
Mar 2007
Posts:
24
Plugin Contributions:
0

Re: TOP category names. Can they be individual images instead?

Awesome. Zen-Cart team blowing me away, once again.

You guys do awesome work.

Thanks