VirtueMart Forum

VirtueMart Dev/Coding Central: VM1 (old version) => Development Projects, Modifications, Hacks & Tweaks. VM1.1 => Topic started by: carsten888 on November 26, 2014, 10:43:07 am

Title: hack: additional images in modal window (instead of direct link to huge photo)
Post by: carsten888 on November 26, 2014, 10:43:07 am
The additional images on the product detail page, when you click on one thumbnail, the huge photo opens with horizontal scrollbars and all. Clicking on the back-button in the browser results in going to the previous page (not the detail page, but the page before that!). To avoid that I open the additional images in a modal window. So the user can see the enlarged image and close it without losing the page. For consistency I added the main image in the thumbnails as well (and override the default_images.php template to not link to the max size photo).

(obviously I made the modifications in a template override, but here is the original file)
line: 24
Code: [Select]
$start_image = VmConfig::get('add_img_main', 1) ? 0 : 1;changed to
Code: [Select]
$start_image = 0;
line: 35
Code: [Select]
echo $image->displayMediaThumb("",true,"rel='vm-additional-images'"); change to
Code: [Select]
echo $image->displayMediaThumb("",true,"class='modal'");
For this too work in the VM config > tab 'templates' > 'Open additional images in the main position' should be unticked.