VirtueMart Forum

VirtueMart 2 + 3 + 4 => Templating & Layouts => Topic started by: EvanGR on October 18, 2013, 13:09:31 PM

Title: Looking for the product image URL (PHP)
Post by: EvanGR on October 18, 2013, 13:09:31 PM
Hello people,

I am modifying a template to add product metadata in the header. I need to add the open graph 'og:image' tag so I need a full-clean URL string to the main product image. I can't get displayMediaFull() to give me what I want, it includes the <img> HTML element. Any ideas?

Thank you!


[joomla 2.4.14, VM 2.0.24]
Title: Re: Looking for the product image URL (PHP)
Post by: Jumbo! on October 19, 2013, 14:10:36 PM
Try this in product details page:

<?php echo $this->product->images[0]->file_url?>

In product listing pages within the foreach loop:

<?php echo $product->images[0]->file_url?>
Title: Re: Looking for the product image URL (PHP)
Post by: EvanGR on October 19, 2013, 15:20:42 PM
Problem solved... Thank you very much!
Title: Re: Looking for the product image URL (PHP)
Post by: Jumbo! on October 19, 2013, 21:40:32 PM
You are welcome.