I have uploaded PDF's as downloadable files in my VM2 shop and they are opening in the main window. I need them to open in new window. I have gone through all the additional images code and cant make head nor tail of how it generates the link for anything that is not an image
Here is a sample of the generated code
<div class="additional-images">
<div class="floatleft">
<a rel='vm-additional-images' target='_blank' href="http://www.thelamp.eu/images/stories/virtuemart/product/8000_k633_nero_02.jpg"><img src="/images/stories/virtuemart/product/8000_k633_nero_02.jpg" alt="" /></a> </div>
<div class="floatleft">
<a href="http://www.thelamp.eu/images/stories/virtuemart/product/8000_k6+3+3_nero.pdf"><img src="http://www.thelamp.eu/components/com_virtuemart/assets/images/vmgeneral/filetype_pdf.png" alt="" /></a> </div>
<div class="clear"></div>
</div>
</div>
Now I can easily manipulate the code for the image as I understand how that is generated.. but the PDF statement (BOLD) seems to be generated completely randomly.. almost out of thin air, I cant find any code that leads to this result.. from what I can see the additional images is just a loop that feeds into a function
<div class="additional-images">
<?php
// List all Images
if (count($this->product->images) > 0) {
foreach ($this->product->images as $image) {
echo '<div class="floatleft" style="padding:5px">' . $image->displayMediaThumb('class="product-image"', true, 'class="modal"', true, true) . '</div>'; //'class="modal"'
}
}
?>
Can anyone advise what code I need to alter to make any 'additional image' that is downloadable appear in a new window.
Got it
I had to hack the mediahandler helper file around line 563 onwards. Change BOLDED
function displayIt($file_url, $file_alt, $imageArgs,$lightbox, $effect ="class='modal'",$withDesc=false,$absUrl = false){
if ($withDesc) $desc='<span class="vm-img-desc">'.$withDesc.'</span>';
else $desc='';
// vmdebug('displayIt $file_alt'.$file_alt,$imageArgs);
if($lightbox){
$image = 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) ) $href = JURI::root() .$this->file_url ;
else $href = $file_url ;
if ($this->file_is_downloadable) {
$lightboxImage = '<a target="_blank" '.$file_alt.' '.$effect.' href="'.$href.'">'.$image.$desc.'</a>';
} else {
$lightboxImage = '<a '.$file_alt.' '.$effect.' href="'.$href.'">'.$image.'</a>';
$lightboxImage = $lightboxImage.$desc;
}