In the category page I would like to show its corresponding alt for each product image, but by default my theme Claue show the product name in the alt label.
In the phtml file /design/frontend/Mgs/claue/Magento_Catalog/templates/product/list.phtml
stripTags($_product->getImageLabel(), null, true); ?>
The problem is that for some images it shows the alternative text and for others it does not and show the alt="".
Somebody could help me?
Hello @juanrdosil
Can you confirm, From the backend on those specific image - you have added alt text for those product images ?
Hello Manthan.
Yes, in the backend all the images have the corresponding alt text.
The strange thing is that then inside the product file the alt if they are displayed correctly.
Kind regards.
Hello @juanrdosil
So in your theme - inside product page template file also written the same code ?- stripTags($_product->getImageLabel(), null, true);
Still it getting the correct alt text over here ?
In the product page for every image in $lbImage obtain the label.
<?php foreach($galleryImages as $image): ?>
<?php $lbImage = $image->getLabel() ? $image->getLabel() : $image->getLabelDefault(); ?>