Author Topic: Different images for sublayout thumbnail and product details  (Read 685 times)

ripple

  • Beginner
  • *
  • Posts: 2
My products have two images and I'd like to use them in the following way:
  • cropped closeup used as a thumbnail in the browse view
  • main image of the product in the product details view
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  :)

ermes

  • 3rd party VirtueMart Developer
  • Jr. Member
  • *
  • Posts: 114
Re: Different images for sublayout thumbnail and product details
« Reply #1 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:
Code: [Select]
$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

GJC Web Design

  • 3rd party VirtueMart Developer
  • Super Hero
  • *
  • Posts: 10170
  • Virtuemart, Joomla & php developer
    • GJC Web Design
  • VirtueMart Version: 3.6.8
Re: Different images for sublayout thumbnail and product details
« Reply #2 on: May 10, 2021, 13:10:10 pm »
Quote
cropped 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
GJC Web Design
VirtueMart and Joomla Developers - php developers http://www.gjcwebdesign.com
VM3 AusPost Shipping Plugin - e-go Shipping Plugin - VM3 Postcode Shipping Plugin - Radius Shipping Plugin - VM3 NZ Post Shipping Plugin - AusPost Estimator
Samport Payment Plugin - EcomMerchant Payment Plugin - ccBill payment Plugin
VM2 Product Lock Extension - VM2 Preconfig Adresses Extension - TaxCloud USA Taxes Plugin - Virtuemart  Product Review Component
http://extensions.joomla.org/profile/profile/details/67210
Contact for any VirtueMart or Joomla development & customisation