M
M
Mikhail Mirgorodsky2020-04-24 13:51:02
Joomla
Mikhail Mirgorodsky, 2020-04-24 13:51:02

How to get virtuemart product image url?

Good afternoon,
Please tell me, when displaying a page with a product, an image is displayed in the default_images.php file with the following code:

if (!empty($this->product->images)) {
  $image = $this->product->images[0];
  ?>
  <div itemscope itemtype="http://schema.org/ImageObject" class="main-image img-fluid m-2">
    <?php
    $width = VmConfig::get('img_width_full', 0);
    $height = VmConfig::get('img_height_full', 0);
    if(!empty($width) or !empty($height)){
      echo $image->displayMediaThumb("",true,"rel='vm-additional-images' itemprop='thumbnailtrue'", true, false, $width, $height);
    } else {
      echo $image->displayMediaFull("",true,"rel='vm-additional-images' itemprop='image'");
    }
     ?>
    <div class="clear"></div>
  </div>
  <?php

How to get a URL from it and use it on the same page, only in a different place, before loading this template?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexey Gnevyshev, 2020-09-24
@PiZZaDoXa

Try this: Paste this after the line:
echo '<p>'.$image->file_url.'</p>';
$image = $this->product->images[0];

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question