VirtueMart Forum

VirtueMart 2 + 3 + 4 => Administration & Configuration => Topic started by: ripple on May 08, 2021, 11:37:24 AM

Title: Different images for sublayout thumbnail and product details
Post by: ripple on May 08, 2021, 11:37:24 AM
My products have two images and I'd like to use them in the following way:
How can I define the first image to be used as a thumbnail in the browse view only, and show only the other main image on the product details page?

EDIT: Note, this may be an issue with the new admin template! I had been trying to enter the /resized/ thumbnail URL into the 'Used thumb url' field, but was never able to get it to save. Each time I tried, the field went blank again. I assumed it was a locked VM setting. BUT, when I changed back to the old admin template, viola! my entry into the 'Used thumb url' field saved. My images are operating as I had hoped. However, shouldn't some VM guru be notified of this template bug?

TIA  :)
Title: Re: Different images for sublayout thumbnail and product details
Post by: ermes on May 10, 2021, 11:49:00 AM
You see that it could easily be a template problem: net of the backend configurations, you can decide in any view (component and modules) the size of the thumbs to be generated as follows:

$image->displayMediaThumb("",true,"", true, true, false, $width, $height);

Where $image is an istance of VmMediaHandler. All images loaded in product via addImages (Es.: $product_model->addImages($product);) are istance of this class. So in any override file of your template you can specify width and height.
This is the best use of it. Very simple and very dynamic.
Following the parameters:

   - @param string $imageArgs Attributes to be included in the <img> tag.
   - @param boolean $lightbox alternative display method
   - @param string $effect alternative lightbox display
   - @param boolean $withDesc display the image media description
   - @param boolean $absUrl use the absolute url
   - @param int $width image width of new thumb
   - @param int $height image height of new thumb
Title: Re: Different images for sublayout thumbnail and product details
Post by: GJC Web Design on May 10, 2021, 13:10:10 PM
Quotecropped closeup used as a thumbnail in the browse view

note that the browse view only loads the first image as standard... so the close cropped would need to be the 1st image

then in the details just loop thru the 2 images and only display the second