VirtueMart Forum

VirtueMart 2 + 3 + 4 => Templating & Layouts => Topic started by: soura123 on February 27, 2019, 12:28:28 PM

Title: change popup image on product view to displayMediaThumb
Post by: soura123 on February 27, 2019, 12:28:28 PM
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
Title: Re: change popup image on product view to displayMediaThumb
Post by: soura123 on February 28, 2019, 09:14:10 AM
Mod edit:  impatient bump message removed. Please read http://forum.virtuemart.net/index.php?topic=104795.0
Title: Re: change popup image on product view to displayMediaThumb
Post by: GJC Web Design on February 28, 2019, 09:39:48 AM
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
}
?>
Title: Re: change popup image on product view to displayMediaThumb
Post by: soura123 on February 28, 2019, 10:05:36 AM
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
Title: Re: change popup image on product view to displayMediaThumb
Post by: soura123 on February 28, 2019, 10:51:55 AM
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?
Title: Re: change popup image on product view to displayMediaThumb
Post by: soura123 on February 28, 2019, 10:57:18 AM
change this
$href = JURI::root() .$this->file_url ;
to
$href = $file_url ;

and fixed it

lol
thanks any way