Page 1 of 2
Empty or Missing alt="" text in some images
Posted: 05 Apr 2021, 10:57
by Alexander
Hi Jan
I ran my site through a SEO check. The check noted, that the alt texts for the PhocaCart products in the PhocaCart slider Module are empty. I checked further and noticed that the alt tags are also empty or missing in the product images if you look at them enlarged in the viewer. Images of categories have proper alt texts.
Is there a way to fix that? Otherwise it might be something that should be fixed in one of the further releases of Phoca Cart.
Kind regards and thank you
Alexander
Re: Empty or Missing alt="" text in some images
Posted: 05 Apr 2021, 12:36
by dmlwebal
Hi Alexander
Yes for general Phoca Cart images
Go to Phoca Cart > Options (upper right) > Display > Alt Value
Set as required
But Product Slide Module, alt tag is left empty
So, it looks like an override is required for Slider Module to add alt text. I will see if it is possible to add the code and reply later
David
Re: Empty or Missing alt="" text in some images
Posted: 05 Apr 2021, 12:58
by dmlwebal
Hi Alexander
So create an override for mod_phocacart_product_scroller
Instructions:
Copy mod_phocacart_product_scroller/tmpl from Modules to /templates/[TEMPLATE]/html/mod_phocacart_product_scroller
You should now have default.php and index.html file in /templates/[TEMPLATE]/html/mod_phocacart_product_scroller folder
Now, edit the new override default.php and go to line 39
Code: Select all
echo '<img src="'.JURI::base(true).'/'.$image->rel.'" alt="" class="'.$s['c']['img-responsive'].' ph-image"';
change to
Code: Select all
echo '<img src="'.JURI::base(true).'/'.$image->rel.'" alt="'.$v->title.'" class="'.$s['c']['img-responsive'].' ph-image"';
take care to add single quotes and string key to value inside alt quotes
Save and close
Clear all caches to update modules and 'Inspect' your slider module images, there should now be alt text visible
Regards
David
Re: Empty or Missing alt="" text in some images
Posted: 05 Apr 2021, 13:41
by Alexander
Hi David
The override for mod_phocacart_product_scroller worked perfectly. Thank you!!!! Great!
I already had the "Alt Value" set to "Title (Category ...)" in the config as the image names are rather cryptic.
The problem with the alt text in the product view (-> modal) remains . I use this "prettyPhoto" option. When I click to enlarge the product and view the different views, the images and thumbnails have no alt text. -> <img id="fullResImage" ...> has no alt text and the thumbnails have an empty alt text.
Kind regards
Alexander
Re: Empty or Missing alt="" text in some images
Posted: 05 Apr 2021, 17:14
by dmlwebal
Ok Alexander,
Thanks for letting me know it worked. Great!
So, product page -> modal/prettyPhoto. I will take a look but it may be tomorrow now
Regards
David
Re: Empty or Missing alt="" text in some images
Posted: 06 Apr 2021, 15:40
by dmlwebal
Hi Alexander
I cannot re-create the issue with your item page modal or thumbnails. Can you provide a url?
Regards
David
Re: Empty or Missing alt="" text in some images
Posted: 06 Apr 2021, 16:00
by Alexander
Hi David
try this one:
https://shark.swiss/shop-en/14-cuddly-s ... rettyPhoto
-> no alt text
or
https://shark.swiss/shop-en/12-shark-ad ... o-adoption
main image no alt Text
in the thumbs the alt text is alt=""
Thanks a lot for your help
Alexander
Re: Empty or Missing alt="" text in some images
Posted: 06 Apr 2021, 16:02
by Alexander
in the small previews beneath the big image the alt Texts are perfect
Re: Empty or Missing alt="" text in some images
Posted: 06 Apr 2021, 16:03
by Alexander
Oh, you have to click on the image so that the Modal pops up. Its in the Modal view
Re: Empty or Missing alt="" text in some images
Posted: 06 Apr 2021, 18:32
by dmlwebal
Hi Alexander
Yes, this is more tricky as I think Phoca Cart has used a 3rd party javascript library for the modal. So, I think that the call will need to be made from within the script.
Not sure you can override this one (so on Phoca Cart update any change may not be preserved)
I'll take another look but this one may need some input form Jan after all.
Regards
Dave
PS I like the cause behind your site - very good!