Empty or Missing alt="" text in some images

Phoca Cart - complex e-commerce extension
Alexander
Phoca Member
Phoca Member
Posts: 39
Joined: 15 Jan 2020, 17:36

Empty or Missing alt="" text in some images

Post by Alexander » 05 Apr 2021, 10:57

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

Tags:

User avatar
dmlwebal
Phoca Professional
Phoca Professional
Posts: 217
Joined: 18 Sep 2019, 12:49

Re: Empty or Missing alt="" text in some images

Post by dmlwebal » 05 Apr 2021, 12:36

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

User avatar
dmlwebal
Phoca Professional
Phoca Professional
Posts: 217
Joined: 18 Sep 2019, 12:49

Re: Empty or Missing alt="" text in some images

Post by dmlwebal » 05 Apr 2021, 12:58

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

Code: Select all

'.$v->title.'
Save and close

Clear all caches to update modules and 'Inspect' your slider module images, there should now be alt text visible

Regards
David

Alexander
Phoca Member
Phoca Member
Posts: 39
Joined: 15 Jan 2020, 17:36

Re: Empty or Missing alt="" text in some images

Post by Alexander » 05 Apr 2021, 13:41

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

User avatar
dmlwebal
Phoca Professional
Phoca Professional
Posts: 217
Joined: 18 Sep 2019, 12:49

Re: Empty or Missing alt="" text in some images

Post by dmlwebal » 05 Apr 2021, 17:14

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

User avatar
dmlwebal
Phoca Professional
Phoca Professional
Posts: 217
Joined: 18 Sep 2019, 12:49

Re: Empty or Missing alt="" text in some images

Post by dmlwebal » 06 Apr 2021, 15:40

Hi Alexander

I cannot re-create the issue with your item page modal or thumbnails. Can you provide a url?

Regards
David

Alexander
Phoca Member
Phoca Member
Posts: 39
Joined: 15 Jan 2020, 17:36

Re: Empty or Missing alt="" text in some images

Post by Alexander » 06 Apr 2021, 16:00

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

Alexander
Phoca Member
Phoca Member
Posts: 39
Joined: 15 Jan 2020, 17:36

Re: Empty or Missing alt="" text in some images

Post by Alexander » 06 Apr 2021, 16:02

in the small previews beneath the big image the alt Texts are perfect

Alexander
Phoca Member
Phoca Member
Posts: 39
Joined: 15 Jan 2020, 17:36

Re: Empty or Missing alt="" text in some images

Post by Alexander » 06 Apr 2021, 16:03

Oh, you have to click on the image so that the Modal pops up. Its in the Modal view

User avatar
dmlwebal
Phoca Professional
Phoca Professional
Posts: 217
Joined: 18 Sep 2019, 12:49

Re: Empty or Missing alt="" text in some images

Post by dmlwebal » 06 Apr 2021, 18:32

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!

Post Reply