VirtueMart Forum

VirtueMart 2 + 3 + 4 => Templating & Layouts => Topic started by: major on November 19, 2012, 14:05:01 PM

Title: Product details image
Post by: major on November 19, 2012, 14:05:01 PM
Hy can't get the image in product details to open the original image.

I have the original image a img with 700px by 700px, and in product details when i click on the image it don't open the original file?

Any ideias.

This is the site http://www.mobiliariocomluz.pt/index.php/mobiliario-de-interior/sofas-e-cadeiras-sem-leds/cokka-chair-transparente_details.html

Thanks
Title: Re: Product details image
Post by: jenkinhill on November 19, 2012, 15:15:16 PM
You are not using the modal code in your product display template, which I assume is an override. See http://forum.virtuemart.net/index.php?topic=98647.0 which has something like the code you need to add to your product details template.
Title: Re: Product details image
Post by: major on November 19, 2012, 15:35:59 PM
I manage to solve the problem with this code http://forum.virtuemart.net/index.php?topic=102249.0
But when i click on the main image i have to do the next button 3 times to show the second image!!!

Any ideia of the problem?

Thanks
Title: Re: Product details image
Post by: major on November 19, 2012, 16:01:12 PM
Final code in  /components/com_virtuemart/views/productdetails/tmpl/default_images.php

<?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');

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

    <div class="main-image">
<?php
//Enable FancyBox
$path JURI::root(true).'/components/com_virtuemart/assets/';
$document JFactory::getDocument();
$document->addStyleSheet($path.'js/fancybox/jquery.fancybox-1.3.4.css');
$document->addScript($path.'js/fancybox/jquery.fancybox-1.3.4.pack.js');
$js 'jQuery(document).ready(function($) { $("a.gallery").fancybox(); });';
$document->addScriptDeclaration($js);
//show thumbnail
echo $this->product->images[0]->displayMediaThumb('class="product-image"',true,'class="gallery" rel="'.$this->product->virtuemart_product_id.'"',true,true);

?>

    </div>
<?php // Product Main Image END ?>

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

    <div class="additional-images">
<?php

// List all Images

if (count($this->product->images) > 0) { //initially it was 1 instead of 0

$imgcnt=0;

$widthinpercent 100/ (count($this->product->images)); // remove -1

    foreach ($this->product->images as $image) {

if($imgcnt!=0){ //initially it was 1 instead of 0

echo '<div class="floatleft width'.$widthinpercent.'">'.$image->displayMediaThumb('class="product-image"',true,'class="gallery" rel="'.$this->product->virtuemart_product_id.'"',true,false).'</div>';

}

$imgcnt++;

    }

}

?>

        <div class="clear"></div>
    </div>
<?php
// Showing The Additional Images END ?>