0

I have been trying to figure out which layer/.phtml/extension is responsible for the empty alt="" in the enlarged images on a site, for example at

https://www.seart.pl/wieszak-polka-vintage-vpk-p-5619.html

The idea is to default to a product or category name when an label is empty. Being somewhat new, I have poured through guides and followed changes in code from related examples, to no avail. Even after I manually refresh some caches (is that necessary?) and rebuild indexes, an F12 element inspection of the resulting HTML in the browser shows a blank alt= value, which affects web crawlers.

https://github.com/adampmoss/CreareSEO had been installed, but does not enforce

Make "alt" tags mandatory on product gallery images?

(only temporarily as in this screenshot)

temporarily enforced alt tags

What other files, templates, extensions or settings should I look into?

These two didn't help:

  • app/design/frontend/base/default/template/catalog/product/view/media.phtml
  • app/design/frontend/rwd/default/template/catalog/product/view/media.phtml
1

The reason your not finding the template responsible is because there is no template file responsible for this. It's a piece of javascript. I took this snippet from your site:

<img src="https://www.seart.pl/media/catalog/product/cache/1/thumbnail/480x/17f82f742ffe127f42dca9de82fb58b1/s/z/szafa_dwudrzwiowa_sosnowa_1.jpg" data-zoom-image="https://www.seart.pl/media/catalog/product/cache/1/thumbnail/960x/17f82f742ffe127f42dca9de82fb58b1/s/z/szafa_dwudrzwiowa_sosnowa_1.jpg" alt="Szafa sosnowa Vintage" title="Szafa sosnowa Vintage" class="main-zoom-img" style="position: absolute;">

If you look closely, the image in the src= tag has a size of 480. (the numbers after the /cache/1/thumbnail part). Then the data-zoom-image= part, contains the larger version of this image. When this element is being clicked, the html is being modified into this fancybox showing you the larger image. You can see this happening if you focus at the html.

The only reason i can think of why this alt tag shouldn't be blank, is SEO purposes. But to my recollection, search engines aren't doing this kind of interaction. They will never see this empty image alt tag because it's not there on page load. And i'm not sure, but i think the bigger version of this image isn't even indexed. Maybe someone can fill me up on this one.

However, it is possible to get something like the product name in this alt tag when it's clicked. You can load complete HTML fragments in fancyboxes like these. I once used it to create an AJAX login window. I think this version is being used at your site.

http://fancyapps.com/fancybox/#docs

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.