0

The images I have given a label to are producing alt tags if it is their product image, but on the product slider .mini-products-list they don't.

Where is the file to edit this? And what variable should be under the alt tag.

To see the problem, check the alt tags of the images on the bottom that scroll:

https://www.mitchellfineartgallery.com/stockroom/affordable-art/the-key

I have located the file here:

/app/design/frontend/mfag/default/template/catalog/product/related.phtml

To generate the alt tag it is using,

  alt="<?php echo $this->stripTags($this->getImageLabel($_product, 'small_image'), null, true) ?>" />

But this doesn't give anything. Anyone know how I can get it to correctly display the label?

0

You have to use title attribute for show image label on hover. Image's alt attribute is called when your image is not found in your site. For show your image label you have to also add label from admin side as attached image. Hope it works.

enter image description here

You have to tried below code:

<img title="<?php echo $this->stripTags($this->getImageLabel($_product, 'small_image'), null, true) ?>" />
  • This isn't a solution? I know that's the code I'm using. I have the label's applied to all of the images. The alt just doesn't generate. What code do I need to do that? I haven't done any custom coding here, alt just appears empty from magento's end. – jojo Aug 1 '18 at 5:41
  • Have you added image labels from admin side? – Raj Aug 1 '18 at 5:43
  • Yes. That's why this is a bit confusling. The labels are there it just doesn't send anything through when it's called. – jojo Aug 1 '18 at 5:44
  • Main-image has the alt tag, but those scrolling ones don't. – jojo Aug 1 '18 at 5:45
  • I think you have to try with load product using id like $product = Mage::getModel('catalog/product')->load($_product->getId()); and check it's work or not. – Raj Aug 1 '18 at 5:48

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.