VirtueMart Forum

VirtueMart 2 + 3 + 4 => Security (https) / Performance / SEO, SEF, URLs => Topic started by: hk on August 30, 2013, 15:52:27 PM

Title: image ALT tag
Post by: hk on August 30, 2013, 15:52:27 PM
Hi,

In the category page, the thumbnail images have an ALT attribute in source view. However, the ALT attribute in empty in Product detail page.

Could you please suggest what change is required, so that ALT attribute has values in Product detail page. This will help in SEO.

Thanks.
Title: Re: image ALT tag
Post by: Maxim Pishnyak on August 30, 2013, 17:42:25 PM
Did you tried to use forum search button before you post?
Title: Re: image ALT tag
Post by: hk on September 02, 2013, 08:29:37 AM
I did a search. There were many threads with similar problem, but could not find a solution.
Title: Re: image ALT tag
Post by: Maxim Pishnyak on September 02, 2013, 08:45:56 AM
Quote from: ivus on August 02, 2012, 09:10:36 AM
Hi communion,

That's because your code is badly formed.

<div class="main-image">
   <?php echo $this->product->images[0]->displayMediaFull('class="medium-image" alt="'.$this->product->text.'" ',true,' title="'.$this->product->product_name.'" ',true,' rel="prettyPhoto[pp_gal]" id="medium-image"', false ); ?>
</div>

the function has the following parameters:

function displayMediaFull($imageArgs='', $lightbox=true, $effect="class='modal'", $description = true ){}

not sure what you are trying to pass into it...

I hope this helps. ;D

Title: Re: image ALT tag
Post by: hk on September 02, 2013, 10:58:05 AM
Not sure which file to be edited.
However I found a similar code in components/com_virtuemart/views/productdetails/tmpl/default_images.php which is as below:
<div class="main-image">

<?php
echo $image->displayMediaFull("",true,"rel='vm-additional-images'");
?>


<div class="clear"></div>
</div>
<?php
$count_images count ($this->product->images);
if ($count_images 1) {
?>

    <div class="additional-images">
<?php
for ($i 1$i $count_images$i++) {
$image $this->product->images[$i];
?>

            <div class="floatleft">
            <?php
                echo 
$image->displayMediaFull("",true,"rel='vm-additional-images'");
            ?>

            </div>

If this file is correct, could you let me know what shoule be changed in this?
Title: Re: image ALT tag
Post by: Maxim Pishnyak on September 02, 2013, 17:50:19 PM
What is your VM version? Do you have template overrides?

And .. don't you see how displayMediaFull is formed in my and yours code peaces?
Title: Re: image ALT tag
Post by: hk on September 03, 2013, 11:12:48 AM
I'm using VM 2.0.18a and I do not have overrides for product detail page.
Title: Re: image ALT tag
Post by: Maxim Pishnyak on September 04, 2013, 23:27:34 PM
Maybe update?
Title: Re: image ALT tag
Post by: hk on September 05, 2013, 10:20:10 AM
Do I need to edit
echo $image->displayMediaFull("",true,"rel='vm-additional-images'");

inorder to change the ALT and Title?
Title: Re: image ALT tag
Post by: Maxim Pishnyak on September 05, 2013, 20:30:16 PM
Yes
Title: Re: image ALT tag
Post by: hk on September 07, 2013, 13:03:52 PM
I was able to get the Title tag after changing the code as:
echo $image->displayMediaFull('title="'.$this->product->product_name.'" ',true,"rel='vm-additional-images' ");

However, I am not getting the ALT tag established. Can you please assist where should I write the code for ALT tag having the Product name.

Thanks.
Title: Re: image ALT tag
Post by: franzpeter on September 07, 2013, 14:02:07 PM
I use VM 2.0.22c and I do not see that issue. If you did not give your pictures a personalized alt description VM takes the product name as alt tag -> automatically. There is no need to overwrite something.