Prestashop: if the caption is void the alt attribute of the product images is void

Created on 28 Jan 2020  路  7Comments  路  Source: PrestaShop/PrestaShop

hi
on the 1.6.x the "alt" attributes of product images if not set, will display the product name.
Instead on the 1.7.x if the "caption" field is void the alt will be void, I think it is not a good news for the seo.
can you set again the same behavior of the 1.6.x?

thanks

Screenshots
4
5

Additional information
PrestaShop version: 1.7.6.2
PHP version: 7.2

FO Fixed Image Improvement PM 鉁旓笍 PR available Products

Most helpful comment

All 7 comments

Hi @maofree,

I have the same behavior as PS1.7.6.3 & PS1.7.5.2.
It is OK with PS1.6.1.24: the "alt" attributes of product images if not set, will display the product name.

I attached a screen record
https://drive.google.com/file/d/1MuX3hQXNQCbFnTj6ksx57AU1XwvSDxBR/view
Ping @PrestaShop/prestashop-product-team what do you think?

Thanks!

hi
this is a problem especially for all those sites that have been updated from versions lower than 1.7, because everyone knew that the name of the product would appear and many left it on purpose, now they are seen without texts in the alt of the images

Hi @khouloudbelguith, @maofree, I agree: if void, the caption should at least set the product name as the alt attribute of the image. Note that the caption may change in case of multiple languages, so might the alt attribute, depending on the browsing language. :-)

hi
to fix this problem, it is necessary only to edit the file product-cover-thumbnails.tpl
from
alt="{$product.cover.legend}
to
alt="{if $product.cover.legend}{$product.cover.legend}{else}{$product.name|truncate:40:''}{/if}"

and from
alt="{$image.legend}
to
alt="{if $image.legend}{$image.legend}{else}{$product.name|truncate:40:''}{/if}"

Hi @maofree,

If you have already fixed it on your end or if you think you can do it, please do send us a pull request!

Thanks!

hi
can you do it for me?
please

yes I'm sure that it will fix the problem, it is the same solution used for product blocks in /miniatures/product.tpl

Was this page helpful?
0 / 5 - 0 ratings

Related issues

marionf picture marionf  路  3Comments

PrestaShark picture PrestaShark  路  3Comments

Prestaworks picture Prestaworks  路  3Comments

vincent-dp picture vincent-dp  路  3Comments

matks picture matks  路  3Comments