I have zencart v1.3.9h, and I've recently installed the "swap images via mouseover addon".
Anyway, I'm trying to find a way to have a descriptive text displayed when hovering over additional product images. The only way I can think to accomplish this is to have individual image alts. Currently, when hovering over an additonal product image, all these images display an alt of the product name.
I found a source who seems to think having these individual alts for additional product images for zencart is possible. Here is what he says:
So here is simple code change that will allow you to automatically have different descriptive text when hovering over one of the additional product images:
The file to modify is additional_images.php located under Includes --> Modules (folder).
In this file, you should see the following line of code:
" $img_thumb = zen_image($products_image_directory . $file, addslashes($products_name), SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT); "
You can replace this line with the following 3 lines:
" $img_alt_main = str_replace($products_image_base,'',$file); $img_alt = str_replace($products_image_extension,'',$img_alt_main); $img_thumb = zen_image($products_image_directory . $file, addslashes($img_alt), SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT); "
You can then either replace the existing file or use the also-fabulous Zen Cart overrides system by putting the file in a folder with the same name as your template under the Includes--> Modules folder.
Now, whatever you want to have appear when hovering over the additional product image, you would simply include this in the file name.
So what particular code modification does is tell Zen Cart to put in the image alt tag whatever appears after the base name in the additional image filename (minus the extension). So in my earlier example, when hovering over the image, I would see "Side_View". If you are naming your additional files with numbers or letters, this code change will not be useful. But if you label them with names like colors, sizes, the view of the photo, etc. etc., you might find this quick little change to be quite useful.
However, my additional_images file has been modified through the "swap images via mouseover" installation. In it, I searched for the code " $img_thumb = zen_image($products_image_directory . $file, addslashes($products_name), SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) " listed above but could not find an exact match.
The code that came closest to it was this:
" $thumb_slashes = zen_image($base_image, addslashes($products_name), SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT); "
I tried replacing this code with the one suggested but didn't see any results on my images (other than that at times they and other content disappeared from my page).
Also, does this code " $thumb_regular = zen_image($base_image, $products_name, SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT); " need to be altered as well? It came right after the other code.
So, can my code be tweaked to still accomplish the goal of portraying individual alts for additional product images?
Or, is there any addon or other CSS modifications out there that would enable a descriptive text when hovering over an image?
I have very minimal knowledge of CSS, and just started with Zencart, so please excuse my lack knowledge or clarity !
Any help would be very much appreciated!