Zen Cart Logo
Forums / Templates, Stylesheets, Page Layout / How to put categorie images in categories tab

How to put categorie images in categories tab

Locked

Views: 1,841

Results 1 to 6 of 6
This thread is locked. New replies are disabled.
7 Jun 2006, 4:19 PM
#1
bmac avatar

bmac

New Zenner

Join Date:
Jun 2006
Location:
Lisboa - Portugal
Posts:
16
Plugin Contributions:
0

How to put categorie images in categories tab

Hi,
Does anyone knows how to put the caterorie images in the tpl_header.php?

I want to show in every page all the categories as images, i've tried to move the code from tpl_index_categories.php (that displays the images) to the tpl_header.php but I get the error divide by 0 that meens that he can't pass the value to calculate the numbers of categories to show and can't divide the available space.

thanks.

(I created a new thread because i couldn't correct the title of the other one...)

7 Jun 2006, 6:52 PM
#2
bmac avatar

bmac

New Zenner

Join Date:
Jun 2006
Location:
Lisboa - Portugal
Posts:
16
Plugin Contributions:
0

Re: How to put categorie images in categories tab

If it helps, the URL of the page is http://brunomachado.net/1301/, notice that I have a couple of categories (with no products or sub cat). what i want is to put the exact layout of the cats in the header, where the cat tags are

8 Jun 2006, 4:55 PM
#3
gjh42 avatar

gjh42

Black Belt

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

Re: How to put categorie images in categories tab

In /includes/modules/your_template/categories_tabs.php, this line

// create link to top level category
  $links_list[] = '<a class="' . $new_style . '" href="' . zen_href_link(FILENAME_DEFAULT, 'cPath=' . (int)$categories_tab->fields['categories_id']) . '">' . $categories_tab_current . '</a> ';

builds the link and its display. You will want to change the href to an img to display your image instead of text. Someone skilled in the intricacies of zc, php and html will have to describe exactly how to do that - choosing the correct image for the category and keeping the link intact.

8 Jun 2006, 8:40 PM
#4
bmac avatar

bmac

New Zenner

Join Date:
Jun 2006
Location:
Lisboa - Portugal
Posts:
16
Plugin Contributions:
0

Re: How to put categorie images in categories tab

Thanks a lot Glenn, couldn't find the correct module php file.
Zen Cart is new to me, but i'm a php, xhtml programmer, so I hope that it wont be a problem to change that.

8 Jun 2006, 9:26 PM
#5
bmac avatar

bmac

New Zenner

Join Date:
Jun 2006
Location:
Lisboa - Portugal
Posts:
16
Plugin Contributions:
0

Re: How to put categorie images in categories tab

For the record,
here is the solution,

first get the images from the db

$categories_tab_query = "select c.categories_id, cd.categories_name, c.categories_image from " .
TABLE_CATEGORIES . " c, " . TABLE_CATEGORIES_DESCRIPTION . " cd
                          where c.categories_id=cd.categories_id and c.parent_id= '0' and cd.language_id='" . (int)$_SESSION['languages_id'] . "' and c.categories_status='1'" .
$order_by;
$categories_tab = $db->Execute($categories_tab_query);

the in the list show them...

$links_list[] = '<a class="' . $new_style . '" href="' . zen_href_link(FILENAME_DEFAULT, 'cPath=' . (int)$categories_tab->fields['categories_id']) . '">' . $categories_tab_current . '</a> '. zen_image(DIR_WS_IMAGES . $categories_tab->fields['categories_image'], $categories_tab->fields['categories_name'], SUBCATEGORY_IMAGE_WIDTH, SUBCATEGORY_IMAGE_HEIGHT);

Once again, thanks Glenn

17 May 2007, 6:39 PM
#6
herghost avatar

herghost

New Zenner

Join Date:
May 2007
Posts:
30
Plugin Contributions:
0

Re: How to put categorie images in categories tab

Where does this point to for the images? Is it /includes/template/mytemplate/images?