I am working on a Magento 1.9 E-commerce webstore and I am currently trying to add alt tags to the thumbnail images for my categories.

I found the template file that seems to generate the category icons in the cateogry pages (app/design/frontend/package/theme/catalog/category/category-banner.phtml)

In that file, there does seem to be a section that pulls the icon images and sets the alt text of the thumbnail to the category title (if I read that right), in an automated system:

    $_imgHtml   = '';
    if ($_imgUrl = $_category->getImageUrl()) {
        $_imgHtml = '<img src="'.$_imgUrl.'" alt="'.$_helper->categoryAttribute($_category, $_category->getName(), 'name').'" />';
        $_imgHtml = $_helper->categoryAttribute($_category, $_imgHtml, 'image');
        echo "<style>body { background: url('".$_imgUrl."') no-repeat center center; background-size: cover; }</style>";

Whether or not that is what it is supposed to be doing (again, not too sure) when I disable images from my browser, the alt text does not appear in the area where the images are located, indicating to me that the code is either not working or is non-existent if the above code is for something else.

I am not sure if there are any phtml files with direct img tags for each image, or if they are created by that generator php function. Any advice? Would be happy to provide more info as needed.

Thank you very much!

Your Answer

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

Browse other questions tagged or ask your own question.