Jump to content

Product Alt Attributes (tags) Missing Prestashop 1.5.6


Phil_Malaysia

Recommended Posts

Hello Vekia,

 

The website is http://kidstoysmalaysia.com.my when I use SEOQuake to analyze my home page.  SEOQuake shows 156 missing alt's out of 164 images.

 

Here's the URL of another tool I use to check the alt's http://www.feedthebot.com/tools/alt/

 

Thanks,

 

Phil  

Edited by Phil_Malaysia (see edit history)
Link to comment
Share on other sites

you will have to edit several .tpl files

 

- product-list.tpl (located in your theme directory)

- homefeatured.tpl (located in homefeatured module)

... and other files where <img> tag appears

 

it will ba a little hard and time consuming work

Link to comment
Share on other sites

  • 4 weeks later...

Hello Vekia,

 

When I edit the files I'll use a variable for the alt img tabs and not a static variable right?  

 

Just verifying with you (I'm a wannabe programmer).  

 

Thanks,

 

Phil

Hello Phil, 

I saw that you updated your alt tags yourself, I am facing the same issue,

Could you advise how I can do it? I sue prestashop 1.5.5.0 and server is godaddy, 

Your help will be much appreciated, 

Thanks, 

El Hadj

Link to comment
Share on other sites

  • 3 months later...

Dear Phil and Vekia

 

I have got the same problem with my theme. I notice when I activate default theme in 1562 all is fine. But with my payed for theme that is said to be based 99%+ on the default theme I ran into this missing alt tab too.

 

So, please, in a nutshell, since the forum is overwhelmed with this question and I am still not sure:

 

1. Default PS install 1562 has the featured.tpl in base/modules/featured/ and in base/themes/default/modules/featured

 

  • When we edit do we only and exclusively have to edit the one in ourtheme/modules/featured?

 

  • If so, can't we just compare default featured.tpl (base/themes/default/modules/featured) with the one of our theme?

 

I tried that:

 

default:

<a href="{$product.link|escape:'html'}" title="{$product.name|escape:html:'UTF-8'}" class="product_image"><img src="{$link->getImageLink($product.link_rewrite, $product.id_image, 'home_default')|escape:'html'}" height="{$homeSize.height}" width="{$homeSize.width}" alt="{$product.name|escape:html:'UTF-8'}" 

my theme:

<img src="{$link->getImageLink($product.link_rewrite, $product.id_image, 'home_default')|escape:'html'}" alt="{$product.legend|escape:'htmlall':'UTF-8'}" />

Since I learned in the forum that 'legend' is deprecated since PS1.5x I tried this...

So I changed it to:

<img src="{$link->getImageLink($product.link_rewrite, $product.id_image, 'home_default')|escape:'html'}" alt="{if !empty($product.legend)}{$product.legend|escape:'htmlall':'UTF-8'}{else}{$product.name|escape:'htmlall':'UTF-8'}{/if}" title="{if !empty($product.legend)}{$product.legend|escape:'htmlall':'UTF-8'}{else}{$product.name|escape:'htmlall':'UTF-8'}{/if}" {if isset($homeSize)} width="{$homeSize.width}" height="{$homeSize.height}"{/if} />

Mh,

did not work. It was just a test since it would have allowed much more. E.g. if $product.name empty then use $short.description or so :) But, since I am no coder and have no clue I am doing I have to use the $product.name var exclusively.

Moreover, since I do not know about an override or so or a db hack, I have to replace all $product.legend in my theme :(

Link to comment
Share on other sites

  • 1 year later...

Hello, I had the problem that Prestashop in 1.5.x has'nt the possibilite of editing the title of the product's images. This value is in the tabla ps_image_lang in the field called legend, and in this table exist the field lang for the languages you have in your store.

 

Well, I've studied a little how the change position method worked in the image tab and I edited it for having an input in every image and be able to edit the image's title (I loaded a lot of products and imagens with a cvs file).

 

Problems:

1- the value you save for the title is the same for diferents languages (in my case is not a problem but if you have several languages you have to introduce a sql and use the value of the lang).

2- You have to edit the title image by image ( but to do it in the database is impossible).

 

The steps:

** In the file images.tpl, the lines:

- 98: We modify the line for having an input: 
<input id="leyenda_image_id" name="leyenda_image_id" value="legend"/>

- 112: We add an icon for saving the title after of the delete link (Ive used a "|" as separator):

 | <a href="#" class="update_product_image" >
					<img src="../img/admin/edit.gif" alt="{l s='Save this image'}" title="{l s='Save this image'}" />

- 254: before $('.delete_product_image').die().live('click', function(e)...... we add the next function:

function afterUpdateLegend(data)
{
showSuccessMessage("Done");
}

-277: We add after the delete method a new method:

$('.update_product_image').die().live('click', function(e)
{
e.preventDefault();
id = $(this).parent().parent().attr('id');
if (confirm("{/literal}{l s='Save?' js=1}{literal}"))
doAdminAjax({
"action":"updateLegend",
"id_image":id,
"legend" : {/literal}$('#leyenda_'+id).val(){literal},
"token" : "{/literal}{$token}{literal}",
"tab" : "AdminProducts",
"ajax" : 1 }, afterUpdateLegend
);
});

** In the file AdminProductsController, lines:

-1528 We add this function:
 

public function ajaxProcessUpdateLegend()
{
$this->display = 'content';
$res = true;
 
$image = new Image((int)Tools::getValue('id_image'));
$image->legend = Tools::getValue('legend');
$res &= $image->update();
 
if ($res)
$this->jsonConfirmation($this->_conf[26]);
else
$this->jsonError(Tools::displayError('An error occurred while attempting to delete the product image.'));
}


There are several parts we can remove from the code, but it works and now I can't test it or improve it, but may it can help to anyone. 

 

Please, make a backup of the files before try to change, regards.

Edited by val_carter (see edit history)
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...