[FIX] Add ALT tag to sub-category images

For Articles relating to more than one ISC version
Martin
Site Admin
Site Admin
Posts: 1854
Joined: Wed Jun 17, 2009 6:30 pm
Location: South Yorkshire UK
Contact:

[FIX] Add ALT tag to sub-category images

Post by Martin »

This is a pretty simple fix and it's a bit of a mystery why it wasn't included sooner...

Anyway... This fix adds the all important ALT tag to your sub category images and resolves XML validation errors, as well as sorting out some basic accessibility issues.

For 5.x Open: /templates/__master/Snippets/SubCatItemImage.html
For 4.x Open: /templates/[your template]/Snippets/SubCatItemImage.html

Find:

Code: Select all

<img src="%%GLOBAL_SubCatImage%%" border="0" />
Replace with:

Code: Select all

<img src="%%GLOBAL_SubCatImage%%" border="0" alt="%%GLOBAL_SubCatName%%" />
Painstik
Posts: 122
Joined: Sun Jul 19, 2009 1:19 pm
Location: Croatia

Re: [FIX] Add ALT tag to sub-category images

Post by Painstik »

I have another ALT tag fix for product images for entire store

For 5.x Open: /lib/general.php

Find:

Code: Select all

$imageThumb .= '<img src="'.$thumb.'" alt="" />';
Replace with:

Code: Select all

$imageThumb .= '<img src="'.$thumb.'" alt="%%GLOBAL_ProductName%%" />';
Need custom coding for Interspire Shopping Cart? Contact me
Martin
Site Admin
Site Admin
Posts: 1854
Joined: Wed Jun 17, 2009 6:30 pm
Location: South Yorkshire UK
Contact:

[FIX] Add ALT tag to Product images

Post by Martin »

This solution was posted by watersidedesigns on the Interspire forum here:
http://www.interspire.com/forum/showpos ... ostcount=7

I've just tidied it up into standard mod/edit format.

Open: /includes/display/ProductDetails.php

Find:

Code: Select all

				$thumbImage = '<img src="'.$thumb.'" alt="" />';
			}
			else if($thumb != '') {
				$thumbImage = '<img src="'.GetConfig('ShopPath').'/'.GetConfig('ImageDirectory').'/'.$thumb.'" alt="" />';
Replace with:

Code: Select all

				$thumbImage = '<img src="'.$thumb.'" alt="'.$GLOBALS['ProductName'].'" />';
			}
			else if($thumb != '') {
				$thumbImage = '<img src="'.GetConfig('ShopPath').'/'.GetConfig('ImageDirectory').'/'.$thumb.'" alt="'.$GLOBALS['ProductName'].'" />';
scruffydoo
Confirmed
Confirmed
Posts: 25
Joined: Wed Jun 17, 2009 11:44 pm
Location: Brisbane, Oz

Re: [FIX] Add ALT tag to sub-category images

Post by scruffydoo »

I couldnt get this to work (or any of the alt tag mods), copied the code exactly and tried several times, I'm on 5.03, any kind soul help me out?
Martin
Site Admin
Site Admin
Posts: 1854
Joined: Wed Jun 17, 2009 6:30 pm
Location: South Yorkshire UK
Contact:

Re: [FIX] Add ALT tag to sub-category images

Post by Martin »

I think the mod from Painstik may have a bug in it as I suspect the %%GLOBAL_ProductName%% tag isn't translated... If it does, don't worry, but just in case here's a fix that might be required.

For 5.x Open: /lib/general.php

Find:

Code: Select all

$imageThumb .= '<img src="'.$thumb.'" alt="" />';
Replace with:

Code: Select all

$imageThumb .= '<img src="'.$thumb.'" alt="'.$GLOBALS['ProductName'].'" />';
Martin
Site Admin
Site Admin
Posts: 1854
Joined: Wed Jun 17, 2009 6:30 pm
Location: South Yorkshire UK
Contact:

Re: [FIX] Add ALT tag to sub-category images

Post by Martin »

scruffydoo wrote:I couldnt get this to work (or any of the alt tag mods), copied the code exactly and tried several times, I'm on 5.03, any kind soul help me out?
I can't find any reason for this to work any differently between 5.03 and the current version so it's likely the problem is more down to a syntax error caused by the editor being used or editee doing the editing.

Can you provide your modified file(s) as a ZIP attachment and I'll take a peek at them.
irisjet
Posts: 1
Joined: Wed Sep 02, 2009 10:31 pm

Re: [FIX] Add ALT tag to sub-category images

Post by irisjet »

I am getting a undefined index error when i try to add this, 5.0.5
Martin
Site Admin
Site Admin
Posts: 1854
Joined: Wed Jun 17, 2009 6:30 pm
Location: South Yorkshire UK
Contact:

Re: [FIX] Add ALT tag to sub-category images

Post by Martin »

irisjet wrote:I am getting a undefined index error when i try to add this, 5.0.5
Which modification and which file? There are three mods above so it would help to know which one is causing the issue.

Cheers.
novista
Confirmed
Confirmed
Posts: 89
Joined: Fri Jul 03, 2009 11:22 pm

Re: [FIX] Add ALT tag to sub-category images

Post by novista »

It would also be helpful to know where you are seeing that error message. If it is on a particular page, can you include a screen shot? There is another person reporting a similar problem.
Michael Kopel
NovistaWeb.com
grantg
Posts: 112
Joined: Thu Oct 08, 2009 11:01 am

Re: [FIX] Add ALT tag to sub-category images

Post by grantg »

I have made the above changes in 5.0.6 and thought this may be of interest to others, if it wasn't already obvious

Open includes/display/SideProductRelated.php

Find alt=""

Replace with: alt="'.$GLOBALS['ProductName'].'"


Now the Related Products also have an alt tag. I do wonder why this has been missed in ISC, especially because the alt="" tag was already there! Nevermind...maybe it'll get fixed sooner rather than later.
Cupar Garden Centre: CS-Cart Professional 2.2.5 (Converted from ISC 6.0.14 Ultimate)
Online Garden Centre: ISC 6.0.14 Professional
Post Reply