News:

Support the VirtueMart project and become a member

Main Menu

image ALT tag

Started by hk, August 30, 2013, 15:52:27 PM

Previous topic - Next topic

hk

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.

Maxim Pishnyak

Did you tried to use forum search button before you post?
You can support Community by voting for Project on the JED
https://extensions.joomla.org/extension/virtuemart/#reviews
Join us at
https://twitter.com/virtuemart

hk

I did a search. There were many threads with similar problem, but could not find a solution.

Maxim Pishnyak

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

You can support Community by voting for Project on the JED
https://extensions.joomla.org/extension/virtuemart/#reviews
Join us at
https://twitter.com/virtuemart

hk

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?

Maxim Pishnyak

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?
You can support Community by voting for Project on the JED
https://extensions.joomla.org/extension/virtuemart/#reviews
Join us at
https://twitter.com/virtuemart

hk

I'm using VM 2.0.18a and I do not have overrides for product detail page.

Maxim Pishnyak

You can support Community by voting for Project on the JED
https://extensions.joomla.org/extension/virtuemart/#reviews
Join us at
https://twitter.com/virtuemart

hk

Do I need to edit
echo $image->displayMediaFull("",true,"rel='vm-additional-images'");

inorder to change the ALT and Title?

Maxim Pishnyak

You can support Community by voting for Project on the JED
https://extensions.joomla.org/extension/virtuemart/#reviews
Join us at
https://twitter.com/virtuemart

hk

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.

franzpeter

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.