VirtueMart Forum

VirtueMart 2 + 3 + 4 => Templating & Layouts => Topic started by: litvines on February 11, 2015, 20:36:17 PM

Title: Always the same image in a lightbox.
Post by: litvines on February 11, 2015, 20:36:17 PM
Hi, I'm very sorry for my rubbish English.
I have installed this quick start template http://portmone.co.ua/index.php/products/sumki/sumka-kozhanaya-001-detail (http://portmone.co.ua/index.php/products/sumki/sumka-kozhanaya-001-detail) and have some trouble with an image in lightbox. It is always the same – the main image of a product. If product has few images and you click on them they appeared in preview, but when you click to enlarge it in lightbox it is always  main image.


Here is my default_images.php file:
<?php
/**
 *
 * Show the product details page
 *
 * @package VirtueMart
 * @subpackage
 * @author Max Milbers, Valerie Isaksen

 * @link http://www.virtuemart.net
 * @copyright Copyright (c) 2004 - 2010 VirtueMart Team. All rights reserved.
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
 * VirtueMart is free software. This version may have been modified pursuant
 * to the GNU General Public License, and as distributed it includes or
 * is derivative of works licensed under the GNU General Public License or
 * other free or open source software licenses.
 * @version $Id: default_images.php 6188 2012-06-29 09:38:30Z Milbo $
 */
// Check to ensure this file is included in Joomla!
defined('_JEXEC') or die('Restricted access');
?>


<script type="text/javascript">
jQuery.noConflict();
jQuery(document).ready(function() {
    jQuery('#additional-images').jcarousel({
      //  vertical: true,
// wrap: 'circular',
        scroll: 1
    });
});

</script>

<?php

// Product Main Image
if (!empty($this->product->images[0])) {
    
?>

    <div class="main-image">
<?php  echo $this->product->images[0]->displayMediaFull('class="medium-image" id="medium-image"'true"class='modal'"true);  ?>
   
   
   
    </div>
<?php // Product Main Image END ?>

<?php





// Showing The Additional Images
// if(!empty($this->product->images) && count($this->product->images)>1) {
if (!empty($this->product->images) and count ($this->product->images)>1) {
    
?>


      <ul id="additional-images">
<?php
// List all Images
if (count($this->product->images) > 0) {
    foreach ($this->product->images as $image) {  ?>

            <li> <img src="<?php echo $image->file_url?>" onclick="changeMainImage(this);" alt="" /></li>
           
    <?php  }
}
?>

  </ul>
<script type="text/javascript">
function changeMainImage(el){
$('medium-image').src = el.src;
}
</script>
<?php
// Showing The Additional Images END ?>
Title: Re: Always the same image in a lightbox.
Post by: jenkinhill on February 11, 2015, 23:39:28 PM
Worked OK for me with Firefox 35.0.1

If you still have problems ask the template supplier about it. http://forum.virtuemart.net/index.php?topic=108212.0