<?php if ($this->request->get['product_id']) { ?>
<!--
//-----------------------------------------
// Product: jCarousel (Product) OpenCart-tr.com
// Yapimci: mirac
// Web Sitesi: http://www.analizburo.com
//-----------------------------------------
-->
<link rel="stylesheet" type="text/css" href="catalog/view/javascript/jquery/jcarousel/lib/jquery.jcarousel.css" />
<link rel="stylesheet" type="text/css" href="catalog/view/javascript/jquery/jcarousel/skins/tango/skin.css" />
<script type="text/javascript" src="catalog/view/javascript/jquery/jcarousel/lib/jquery.jcarousel.pack.js"></script>
<script type="text/javascript">
// Get main product image dimensions from db
var imageWidth = '<?php echo $this->config->get("config_image_thumb_width"); ?>';
var imageHeight = '<?php echo $this->config->get("config_image_thumb_height"); ?>';
$(document).ready(function(){
// Start jCarousel
$('#mycarousel').jcarousel();
$("#mycarousel li img").each(function(){
$(this).hover(function () {
var imgSrc = $(this).attr('src'); // get img src
var imgPath = imgSrc.substring(0, imgSrc.lastIndexOf('/') + 1); // get img path without filename
var imgName = imgSrc.substring(imgSrc.lastIndexOf('/') + 1, imgSrc.lastIndexOf('-')); // get img file name without extension (eg: image_1)
var imgExt = imgSrc.substring(imgSrc.lastIndexOf('.'), imgSrc.length); // get img file extension (eg: .jpg)
var newSrc = imgPath + imgName + '-' + imageWidth + 'x' + imageHeight + imgExt;
var newhref = $(this).parent().attr('href');
$('#image').attr({
src: newSrc,
title: $(this).attr('title'),
alt: $(this).attr('alt')
});
$('#image').parent().attr('href', newhref);
});
});
// Remove the images tab
$("#tab_image").remove();
$('div.tabs a').each(function(){
if ($(this).attr('tab') == '#tab_image') {
$(this).remove();
}
});
});
</script>
<?php
// Pre-load needed image sizes for all additional images
$this->load->model('catalog/product');
$this->load->model('tool/image');
$product_info = $this->model_catalog_product->getProduct($this->request->get['product_id']);
if ($product_info['image']) {
$image = $product_info['image'];
} else {
$image = 'no_image.jpg';
}
//$thumb1 = $this->model_tool_image->resize($image, $this->config->get('config_image_additional_width'), $this->config->get('config_image_additional_height'));
$thumb1 = (class_exists('HelperImage')) ? HelperImage::resize($image, $this->config->get('config_image_additional_width'), $this->config->get('config_image_additional_height')) : $this->model_tool_image->resize($image, $this->config->get('config_image_additional_width'), $this->config->get('config_image_additional_height'));
$results = $this->model_catalog_product->getProductImages($this->request->get['product_id']);
foreach ($results as $result) {
(class_exists('HelperImage')) ? HelperImage::resize($result['image'], $this->config->get('config_image_thumb_width'), $this->config->get('config_image_thumb_width')) : $this->model_tool_image->resize($result['image'], $this->config->get('config_image_thumb_width'), $this->config->get('config_image_thumb_width'));
}
?>
<?php if ($images) { ?>
<div id="wrap">
<ul id="mycarousel" class="jcarousel-skin-tango">
<li><a href="<?php echo $popup; ?>" rel="prettyPhoto[pp_gal]" title="<?php echo $heading_title; ?>"><img src="<?php echo $thumb1; ?>" alt="<?php echo $heading_title; ?>" /></a></li>
<?php foreach ($images as $image) { ?>
<li><a href="<?php echo $image['popup']; ?>"rel="prettyPhoto[pp_gal]" title="<?php echo $heading_title; ?>"><img src="<?php echo $image['thumb']; ?>" alt="<?php echo $heading_title; ?>" /></a></li>
<?php } ?>
</ul>
</div>
<?php } ?>
<?php } ?>