Page 1 of 1

Changing the main images ALT text when the image changes.

Posted: Mon Feb 23, 2009 3:30 pm
by norman
You can use variables ExtraImage0 Alt Text ... ExtraImage6 Alt Text to display ALT text for the icons. If you'd like the main product image's ALT text to follow suit do the following:

Edit layout "Extra Image Table".

Look for the lines:

Code: Select all

echo "<img width=\"$iconwidth\" height=\"$iconheight\" src=\"$icontouse\"";
echo " alt=\"$alttext\"";
Replace them with:

Code: Select all

$alttext = htmlentities($alttext);
echo "<img width=\"$iconwidth\" height=\"$iconheight\" src=\"$icontouse\"";
echo " alt=\"$alttext\" title=\"$alttext\"";
Look for the line:

Code: Select all

$mouseovercode .= "document.getElementById('$productimageid').src='$extraimagetouse';";
Change this to be:

Code: Select all

$mouseovercode .= "var img=document.getElementById('$productimageid');img.src='$extraimagetouse';img.alt=this.alt;img.title=this.alt;";
Look for the line:

Code: Select all

echo " onclick=\"document.getElementById('$productimageid').src='$extraimagetouse'\"";
Change this to be:

Code: Select all

echo " onclick=\"var img=document.getElementById('$productimageid');img.src='$extraimagetouse';img.alt=this.alt;img.title=this.alt;\"";