News:

Support the VirtueMart project and become a member

Main Menu

change popup image on product view to displayMediaThumb

Started by soura123, February 27, 2019, 12:28:28 PM

Previous topic - Next topic

soura123

hello
is it possible and how to change popup image from product view
from fullimage to displayMediaThumb

vm version 3.4.2 joomla 3.9.3

thanks in advanced

soura123

#1
Mod edit:  impatient bump message removed. Please read http://forum.virtuemart.net/index.php?topic=104795.0

GJC Web Design

its already there in the template...

if (!empty($this->product->images)) {
   $image = $this->product->images[0];
   ?>
   <div class="main-image">
      <?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'", true, true, false, $width, $height);
      } else {
         echo $image->displayMediaFull("",true,"rel='vm-additional-images'");
      }
       ?>
      <div class="clear"></div>
   </div>
   <?php
}
?>
GJC Web Design
VirtueMart and Joomla Developers - php developers https://www.gjcwebdesign.com
VM4 AusPost Shipping Plugin - e-go Shipping Plugin - VM4 Postcode Shipping Plugin - Radius Shipping Plugin - VM4 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
https://extensions.joomla.org/profile/profile/details/67210
Contact for any VirtueMart or Joomla development & customisation

soura123

hello
thanks for your reply
you misunderstand
on the product view i have managed to display the mediathumb
if (!empty($this->product->images)) {
   $image = $this->product->images[0];
   //$title_file = $image->file_name;
   $title_file = '';
   $title_file = ($image->file_meta == '') ? ' title="'. $image->file_name .'"' : ' title="'. $image->file_meta .'"';
   ?>
      <?php echo $image->displayMediaThumb( 'id="zoom-image"',true, 'data-rel="vm-additional-images"'.$title_file ); ?>
      <?php //echo $image->displayMediaFull("",true,"rel='vm-additional-images'"); ?>
   <?php
}
?>

but on click to see bigger image (fancybox) i see the full image
i want on the popup to change to thumb and not full image

i have find in jquery.custom.fancybox-1.3.4.pack.js
.attr({id:"fancybox-img",src:v.src,alt:e.title})

i dont know js and if this is the one i have to edit

soura123

i found from where the link to the popup is generated

on administrator/components/com_virtuemart/helpers/mediahandler.php
on line 612
if($lightbox){
         $image = '<img src="' . $root.$file_url . '" alt="' . $file_alt . '" ' . $args . ' />';//JHtml::image($file_url, $file_alt, $imageArgs);
         if ($file_alt ) $file_alt = 'title="'.$file_alt.'"';
         if ($this->file_url and pathinfo($this->file_url, PATHINFO_EXTENSION) and substr( $this->file_url, 0, 4) != "http") {
            if($this->file_is_forSale){
               $href = $this->file_url ;
            } else {
               $href = JURI::root() .$this->file_url ;
            }

         } else {
            $href = $root.$file_url ;
         }
i try out file_url_thumb but it is blank
any ideas?

soura123

change this
$href = JURI::root() .$this->file_url ;
to
$href = $file_url ;

and fixed it

lol
thanks any way