cancel
Showing results for 
Search instead for 
Did you mean: 

Alt title images in category page

Alt title images in category page

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?

4 REPLIES 4

Re: Alt title images in category page

Hello @juanrdosil 

 

Can you confirm, From the backend on those specific image - you have added alt text for those product images ?

 

 

if issue solved,Click Kudos & Accept as Solution

Re: Alt title images in category page

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.

Re: Alt title images in category page

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 ?

if issue solved,Click Kudos & Accept as Solution

Re: Alt title images in category page

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(); ?>