Forums / General Questions / Images for Visual Description instead of text Categories Tabs files

Images for Visual Description instead of text Categories Tabs files

Started by racingtech on 31 Jul 2015, 12:33 AM · Views: 1,434

Results 1 to 18 of 18
31 Jul 2015, 12:33 AM
#1
racingtech avatar

racingtech

New Zenner

Join Date:
Nov 2012
Location:
US
Posts:
61
Plugin Contributions:
0

Images for Visual Description instead of text Categories Tabs files

I'm using Zen Cart version 1.5.4
What I would like to do is instead of showing the text description of the level one categories, I would like to show the image for the level one categories. I have no plugins that affect the categories tabs files.

I thought it would be simple but, this is not the first time I'm wrong.

Any help would be appreciated.

Thanks

31 Jul 2015, 1:07 AM
#2
mc12345678 avatar

mc12345678

Totally Zenned

Join Date:
Jul 2012
Posts:
16,908
Plugin Contributions:
2

Re: Images for Visual Description instead of text Categories Tabs files

If you find the code section that allows showing images instead of text, then you could at one or the other sides apply a check for the master_categories_id and if that is 0 then display the image, otherwise dislay the "other option". Unless I've missed something with one of the configuration options.

ZC Installation/Maintenance Support <- Site
Contribution for contributions welcome...

31 Jul 2015, 1:33 AM
#3
racingtech avatar

racingtech

New Zenner

Join Date:
Nov 2012
Location:
US
Posts:
61
Plugin Contributions:
0

Re: Images for Visual Description instead of text Categories Tabs files

mc12345678:

If you find the code section that allows showing images instead of text, then you could at one or the other sides apply a check for the master_categories_id and if that is 0 then display the image, otherwise dislay the "other option". Unless I've missed something with one of the configuration options.

Thanks for the quick response. I'll take a look there.

31 Jul 2015, 1:50 AM
#4
mc12345678 avatar

mc12345678

Totally Zenned

Join Date:
Jul 2012
Posts:
16,908
Plugin Contributions:
2

Re: Images for Visual Description instead of text Categories Tabs files

Just took a quick lap through the configuration settings. Have you perchance looked at the product lsting settings? There is an option to show images with top category and an option to show imges with sub-categories... A lot easier than coding something "new" :)

ZC Installation/Maintenance Support <- Site
Contribution for contributions welcome...

31 Jul 2015, 1:55 AM
#5
racingtech avatar

racingtech

New Zenner

Join Date:
Nov 2012
Location:
US
Posts:
61
Plugin Contributions:
0

Re: Images for Visual Description instead of text Categories Tabs files

mc12345678:

Just took a quick lap through the configuration settings. Have you perchance looked at the product lsting settings? There is an option to show images with top category and an option to show imges with sub-categories... A lot easier than coding something "new" :)

Just looked and didn't see anything. Traveled through the rest of them also and couldn't come up with anything.

Seems there aren't many things I can configure regarding the category tabs in the admin. Just show of don't show the menu.

Thanks

31 Jul 2015, 3:57 AM
#6
mc12345678 avatar

mc12345678

Totally Zenned

Join Date:
Jul 2012
Posts:
16,908
Plugin Contributions:
2

Re: Images for Visual Description instead of text Categories Tabs files

Ahh, so want this in the categories tab menu, okay, so here's my feeble attempt to edit includes/modules/YOUR_TEMPLATE/categories_tab.php after copying the original to your template directory:

$links_list = array();

while (!$categories_tab->EOF) {
  $parent_cat = array();
  zen_get_parent_categories($parent_cat, $categories_tab->fields['categories_id']);

  // currently selected category
  if ((int)$cPath == $categories_tab->fields['categories_id']) {
    $new_style = 'category-top';
    if (sizeof($parent_cat) == 0) {
    $categories_tab_current = '<span class="category-subs-selected">' . $categories_tab->fields['categories_image'] . '</span>';
    } else {
    $categories_tab_current = '<span class="category-subs-selected">' . $categories_tab->fields['categories_name'] . '</span>';
    }
  } else {
    $new_style = 'category-top';
    if (sizeof($parent_cat) == 0) {
    $categories_tab_current = $categories_tab->fields['categories_image'];
    } else {
    $categories_tab_current = $categories_tab->fields['categories_name'];
    }
  }

Note that the entire code of the module is not included.

ZC Installation/Maintenance Support <- Site
Contribution for contributions welcome...

31 Jul 2015, 4:28 AM
#7
mc12345678 avatar

mc12345678

Totally Zenned

Join Date:
Jul 2012
Posts:
16,908
Plugin Contributions:
2

Re: Images for Visual Description instead of text Categories Tabs files

Try again, this time with the image beng generated hopefully... :P

Ahh, so want this in the categories tab menu, okay, so here's my feeble attempt to edit includes/modules/YOUR_TEMPLATE/categories_tab.php after copying the original to your template directory:

$links_list = array();

while (!$categories_tab->EOF) {
  $parent_cat = array();
  zen_get_parent_categories($parent_cat, $categories_tab->fields['categories_id']);

  // currently selected category
  if ((int)$cPath == $categories_tab->fields['categories_id']) {
    $new_style = 'category-top';
    if (sizeof($parent_cat) == 0) {
    $categories_tab_current = '<span class="category-subs-selected">' . zen_image($categories_tab->fields['categories_image'],##$categories_tab->fields['categories_name'],##SMALL_IMAGE_WIDTH,,##SMALL_IMAGE_HEIGHT) . '</span>';
    } else {
    $categories_tab_current = '<span class="category-subs-selected">' . $categories_tab->fields['categories_name'] . '</span>';
    }
  } else {
    $new_style = 'category-top';
    if (sizeof($parent_cat) == 0) {
    $categories_tab_current =  zen_image($categories_tab->fields['categories_image'],##$categories_tab->fields['categories_name'],##SMALL_IMAGE_WIDTH,,##SMALL_IMAGE_HEIGHT);
    } else {
    $categories_tab_current = $categories_tab->fields['categories_name'];
    }
  }

Note that the entire code of the module is not included.

Sorry it took so long, hard to do on a mobile phone.

ZC Installation/Maintenance Support <- Site
Contribution for contributions welcome...

31 Jul 2015, 4:39 AM
#8
mc12345678 avatar

mc12345678

Totally Zenned

Join Date:
Jul 2012
Posts:
16,908
Plugin Contributions:
2

Re: Images for Visual Description instead of text Categories Tabs files

And as a result of copying and pasting from various places using my phone there are extra characters (#) and an accidental extra comma in two places.

Try again, this time with the image being generated hopefully... :P

Ahh, so want this in the categories tab menu, okay, so here's my feeble attempt to edit includes/modules/YOUR_TEMPLATE/categories_tab.php after copying the original to your template directory:

$links_list = array();

while (!$categories_tab->EOF) {
  $parent_cat = array();
  zen_get_parent_categories($parent_cat, $categories_tab->fields['categories_id']);

  // currently selected category
  if ((int)$cPath == $categories_tab->fields['categories_id']) {
    $new_style = 'category-top';
    if (sizeof($parent_cat) == 0) {
    $categories_tab_current = '<span class="category-subs-selected">' . zen_image($categories_tab->fields['categories_image'], $categories_tab->fields['categories_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</span>';
    } else {
    $categories_tab_current = '<span class="category-subs-selected">' . $categories_tab->fields['categories_name'] . '</span>';
    }
  } else {
    $new_style = 'category-top';
    if (sizeof($parent_cat) == 0) {
    $categories_tab_current =  zen_image($categories_tab->fields['categories_image'], $categories_tab->fields['categories_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT);
    } else {
    $categories_tab_current = $categories_tab->fields['categories_name'];
    }
  }

Note that the entire code of the module is not included.

Sorry it took so long, hard to do on a mobile phone.

ZC Installation/Maintenance Support <- Site
Contribution for contributions welcome...

31 Jul 2015, 1:31 PM
#9
racingtech avatar

racingtech

New Zenner

Join Date:
Nov 2012
Location:
US
Posts:
61
Plugin Contributions:
0

Re: Images for Visual Description instead of text Categories Tabs files

mc12345678:

And as a result of copying and pasting from various places using my phone there are extra characters (#) and an accidental extra comma in two places.

Try again, this time with the image being generated hopefully... :P

Ahh, so want this in the categories tab menu, okay, so here's my feeble attempt to edit includes/modules/YOUR_TEMPLATE/categories_tab.php after copying the original to your template directory:

$links_list = array();

while (!$categories_tab->EOF) {
$parent_cat = array();
zen_get_parent_categories($parent_cat, $categories_tab->fields['categories_id']);

// currently selected category
if ((int)$cPath == $categories_tab->fields['categories_id']) {
$new_style = 'category-top';
if (sizeof($parent_cat) == 0) {
$categories_tab_current = '<span class="category-subs-selected">' . zen_image($categories_tab->fields['categories_image'], $categories_tab->fields['categories_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</span>';
} else {
$categories_tab_current = '<span class="category-subs-selected">' . $categories_tab->fields['categories_name'] . '</span>';
}
} else {
$new_style = 'category-top';
if (sizeof($parent_cat) == 0) {
$categories_tab_current = zen_image($categories_tab->fields['categories_image'], $categories_tab->fields['categories_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT);
} else {
$categories_tab_current = $categories_tab->fields['categories_name'];
}
}

> 
> Note that the entire code of the module is not included.
> 
> Sorry it took so long, hard to do on a mobile phone.

Wouldn't want to try that on a mobile phone, have enough trouble with a computer.

Thank you very much, I'll give that a try and let you know what happens.
2 Aug 2015, 5:44 PM
#10
racingtech avatar

racingtech

New Zenner

Join Date:
Nov 2012
Location:
US
Posts:
61
Plugin Contributions:
0

Re: Images for Visual Description instead of text Categories Tabs files

Many many thanks to m12345678 for getting me well down the correct path to the solution.

I added c.categories_image to the query and added to the selected DIR_WS_IMAGES . $categories_tab->fields['categories_image'] and it worked.

I revised the this line -

$categories_tab_current = '<span class="category-subs-selected">' . zen_image(DIR_WS_IMAGES . $categories_tab->fields['categories_image'], $categories_tab->fields['categories_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . $categories_tab->fields['categories_name'] . '</span>';

in an effort to get the category name to appear under the image (thinking here is for SEO). This may create a duplicate category and be bad for the site but may be good. At least I would have a choice whether to display or not. Any help here would be appreciated.

Again, many many thanks to m12345678.

2 Aug 2015, 7:48 PM
#11
mc12345678 avatar

mc12345678

Totally Zenned

Join Date:
Jul 2012
Posts:
16,908
Plugin Contributions:
2

Re: Images for Visual Description instead of text Categories Tabs files

racingtech:

Many many thanks to m12345678 for getting me well down the correct path to the solution.

I added c.categories_image to the query and added to the selected DIR_WS_IMAGES . $categories_tab->fields['categories_image'] and it worked.

I revised the this line -

$categories_tab_current = '<span class="category-subs-selected">' . zen_image(DIR_WS_IMAGES . $categories_tab->fields['categories_image'], $categories_tab->fields['categories_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . $categories_tab->fields['categories_name'] . '</span>';

in an effort to get the category name to appear under the image (thinking here is for SEO). This may create a duplicate category and be bad for the site but may be good. At least I would have a choice whether to display or not. Any help here would be appreciated.

Again, many many thanks to m12345678.

Not sure I understand how the duplicate category would be dsplayed if the above was bascally substituted as improvements above what I provided.. Yes, need the images directory as included, and obviously the c.categories_images in the sql. But the way the code ws rewritten was to try to provide only an image for the first order categories. In so doing to offer the category name when hoverng over the image as the alternate text (some browsers respond differently). Adding the category name as has been shown above will put the name to the right of the image unless other things force it to wrap to the next line.

Yes, I was concerned about the category name missing from the list, but the request had been to show the image instead of the name, not in addition to the name. :)

If you want further control, you could add some addtional things, such as wrap the name in a span class to offer css control. Can also add an admin switch to activate/deactivate this capability of showing the image. As things are with ZC, the capabilities are pretty much whatever you want to have done. :)

ZC Installation/Maintenance Support <- Site
Contribution for contributions welcome...

2 Aug 2015, 10:27 PM
#12
dbltoe avatar

dbltoe

Totally Zenned

Join Date:
Jan 2004
Location:
N of San Antonio TX
Posts:
9,900
Plugin Contributions:
22

Re: Images for Visual Description instead of text Categories Tabs files

Sorry to be late to the party. There's just one thing I'd like to "throw out there." Every search engine is blind as a bat. None of them can "see" an image. They are either "in the dark" or "told" what the image is by the alt tag of the particular image. If a category was, for example peppers, an alt tag of red, green, yellow, etc would be fine for categories of color. However, a non-descriptive alt tag could damage your standing with the SEs.
Since content is king these days, you need to ask yourself if replacing a good description with a short alt tag is going to help or hurt. If you stick with the image, make sure it has a very descriptive alt tag.:yes:

Need a hand with Zen Cart? Hire the team at myZenCartZone.com for upgrades, repairs, and custom plugins.
Zen Cart Certified hosting at myZenCartHost.com

3 Aug 2015, 3:51 AM
#13
racingtech avatar

racingtech

New Zenner

Join Date:
Nov 2012
Location:
US
Posts:
61
Plugin Contributions:
0

Re: Images for Visual Description instead of text Categories Tabs files

The initial request was to change the text to an image and the alterations correctly presented as not complete and did work to do exactly what I was asking it to do when I made the alterations. I posted the revisions I made to help with anyone who saw this thread and maybe wasn't an experienced programmer and wanted to use the code so that they would be aware of what I added to make it work. The code and the path did exactly as I asked and were very much appreciated.

I now have the appearance that I want on the site and as stated I can always include the descriptive text within the image but for SEO purposes I have some concerns.

  1. I don't know if as with other images that are presented on the page whether there is a programmatically added alt tag supplied, based on the revisions I don't thing there would be and that was not addressed in the original request. I haven't researched how to add an alt tag to and image yet but, if I add the span statement and include the text then I don't think I'd have to be concerned unless there is a penalty for having an image that does not have an alt tag. I'll at least check both of these to see what I can find out.

  2. Even if there is an alt tag supplied or I add the span statement and style it, as suggested, whether the search engines would see that as duplicate content if I also decided to show the categories in the site bar. So I was kind of thinking that originally if I had just the image and no text and the sidebar had the categories, I would still get indexed for them and wouldn't be penalized for duplicate content.

At this stage I guess it comes down to how the main page with the sidebar get indexed. I am definitely happy that the images show up in the categories_tab and that won't change. Maybe I'm overthinking it.

I appreciate everyone who is taking a look as well as all the veteran help!

3 Aug 2015, 5:55 AM
#14
lruskauff avatar

lruskauff

Totally Zenned

Join Date:
Sep 2008
Location:
WA
Posts:
559
Plugin Contributions:
0

Re: Images for Visual Description instead of text Categories Tabs files

Can I get a link so I can see what you did? Thanks

Lruskauff

3 Aug 2015, 3:16 PM
#15
racingtech avatar

racingtech

New Zenner

Join Date:
Nov 2012
Location:
US
Posts:
61
Plugin Contributions:
0

Re: Images for Visual Description instead of text Categories Tabs files

lruskauff:

Can I get a link so I can see what you did? Thanks

Lruskauff

Worked through the stylesheet to get it how I wanted so this is a final.

http://www.bikerschrome.com

3 Aug 2015, 3:45 PM
#16
mc12345678 avatar

mc12345678

Totally Zenned

Join Date:
Jul 2012
Posts:
16,908
Plugin Contributions:
2

Re: Images for Visual Description instead of text Categories Tabs files

racingtech:

The initial request was to change the text to an image and the alterations correctly presented as not complete and did work to do exactly what I was asking it to do when I made the alterations. I posted the revisions I made to help with anyone who saw this thread and maybe wasn't an experienced programmer and wanted to use the code so that they would be aware of what I added to make it work. The code and the path did exactly as I asked and were very much appreciated.

I now have the appearance that I want on the site and as stated I can always include the descriptive text within the image but for SEO purposes I have some concerns.

  1. I don't know if as with other images that are presented on the page whether there is a programmatically added alt tag supplied, based on the revisions I don't thing there would be and that was not addressed in the original request. I haven't researched how to add an alt tag to and image yet but, if I add the span statement and include the text then I don't think I'd have to be concerned unless there is a penalty for having an image that does not have an alt tag. I'll at least check both of these to see what I can find out.

  2. Even if there is an alt tag supplied or I add the span statement and style it, as suggested, whether the search engines would see that as duplicate content if I also decided to show the categories in the site bar. So I was kind of thinking that originally if I had just the image and no text and the sidebar had the categories, I would still get indexed for them and wouldn't be penalized for duplicate content.

At this stage I guess it comes down to how the main page with the sidebar get indexed. I am definitely happy that the images show up in the categories_tab and that won't change. Maybe I'm overthinking it.

I appreciate everyone who is taking a look as well as all the veteran help!

Thought I had posted this, but I don't see it in the thread...

  1. I purposefully associated an alt tag with this image by including the category_name field in the below(which includes the DIR_WS_IMAGES correction from above):
zen_image(DIR_WS_IMAGES . $categories_tab->fields['categories_image'], $categories_tab->fields['categories_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT)

That uses the form provided in includes/functions/html_output.php

function zen_image($src, $alt = '', $width = '', $height = '', $parameters = '')

With no parameters provided (5th grouping omitted) causing that value to be ''.

  1. So you're saying that having a link on your page that directly goes to the same content as another link is equivalent to duplicate content? That a link should only exist on a page one time? I believe there is confusion in that concept. Generally speaking the duplicate content appears when two separate URIs lead to the same information and that slightly further they do not have equivalent canonical information, nor any other indicator that would be used to say that it is/was understood/known by the site owner that each such page is a duplicate. The span statement to which I was referring is only for formatting, it has nothing to do with SEO. It allows you to customize the text/content presentation using CSS for the particulars between the span tags rather than having to "toy" with other factors.

Every link will eventually be followed and evaluated for indexing. Information about what is at that link or on the page to which that link points will offer the search engines something on which to evaluate. This process can be made better/easier through other helpful tools, but in the end it is up to the search engine as to whether a page will/will not be indexed...

ZC Installation/Maintenance Support <- Site
Contribution for contributions welcome...

3 Aug 2015, 3:55 PM
#17
mc12345678 avatar

mc12345678

Totally Zenned

Join Date:
Jul 2012
Posts:
16,908
Plugin Contributions:
2

Re: Images for Visual Description instead of text Categories Tabs files

Started to play around with the CSS on the site, but it looks like it may take a little more to cause the background image of a selected item to remain different than a non-selected image...

I would think (call it a "preference") that if say a customer selected the maintenance category, then maintenance ought to remain "visibly" selected as I found it possible to go Maintenance - Electrical Components - Coils at which point I am seeing product, but if I switched over to Accessories, I may not know how I got to the coils and also get lost elsewhere in the site... The span class item is there, but it seems to only override the image and not the link... Also noticed that you had to go and add the words to the image instead of displaying them...

Anyways just a thought/opinion, you know something everyone has... :)

ZC Installation/Maintenance Support <- Site
Contribution for contributions welcome...

3 Aug 2015, 4:22 PM
#18
racingtech avatar

racingtech

New Zenner

Join Date:
Nov 2012
Location:
US
Posts:
61
Plugin Contributions:
0

Re: Images for Visual Description instead of text Categories Tabs files

mc12345678:

Started to play around with the CSS on the site, but it looks like it may take a little more to cause the background image of a selected item to remain different than a non-selected image...

I would think (call it a "preference") that if say a customer selected the maintenance category, then maintenance ought to remain "visibly" selected as I found it possible to go Maintenance - Electrical Components - Coils at which point I am seeing product, but if I switched over to Accessories, I may not know how I got to the coils and also get lost elsewhere in the site... The span class item is there, but it seems to only override the image and not the link... Also noticed that you had to go and add the words to the image instead of displaying them...

Anyways just a thought/opinion, you know something everyone has... :)

Thanks for taking a look again.
I did notice that on mouse over that the category shows up. My thinking is that, that would satisfy definition for SEO purposes.

The point about the image not informing a customer is valid and I would think very desirable. I wouldn't know where to start to accomplish that though.

I really appreciate you advise.