Link Thumbnail to Pop Up Link in Multiple Column View (v. 2.8x)
When using the multi column view (Columns 2 - Columns 6 in the product layout), clicking an image (or the item name) takes you to the detail screen.
If you would like to change this so that clicking the image opens up a pop up page (while still keeping the item link as-is), you can use the following modification.
Note: this will map images to the pop up pages in order. In other words:
- Thumbnail URL will link to Pop-Up Page 1
- Thumbnail 2 will link to Pop-Up Page 2
- Thumbnail 3 will link to Pop-Up Page 3
If you do not have a pop up page assigned, the image will link to the detail item screen just as it did before.
-
Open the products_variables.php file in the /enc/ folder.
-
Find the var_imglink function, around line 596.
-
In that function, change the code:
function var_imglink($varsmimage, $varmultilink, $varitem, $varalt, $varclass)
to:
function var_imglink($varsmimage, $varmultilink, $varitem, $varalt, $varclass, $varpop='')
-
In that same function, add the code:
// IF THERE IS A POPUP USE IT
if (!empty($varpop) AND !empty($varsmimage))
{
$popimg = applyimgsize(imgpathtourl($varsmimage), $varalt, $imgheight, $imgwidth, $varclass, $varitem);
$dispimglink = "$popimg
";
}
// OTHERWISE USE LINK TO DETAIL SCREEN
elsejust above the code:
if (!empty($varsmimage))
-
Open the products_multiple.php file in the /enc/ folder.
-
Change the code:
$display_imglink1 = var_imglink($display_sm_image1, $multitemlink, $stripitem, $stripalt, "smalllinkimage1"); $display_imglink2 = var_imglink($display_sm_image2, $multitemlink, $stripitem, $stripalt, "smalllinkimage2"); $display_imglink3 = var_imglink($display_sm_image3, $multitemlink, $stripitem, $stripalt, "smalllinkimage3");
to:
$display_imglink1 = var_imglink($display_sm_image1, $multitemlink, $stripitem, $stripalt, "smalllinkimage1", $searchrow[PopUpPg]); $display_imglink2 = var_imglink($display_sm_image2, $multitemlink, $stripitem, $stripalt, "smalllinkimage2", $searchrow[PopUpPg2]); $display_imglink3 = var_imglink($display_sm_image3, $multitemlink, $stripitem, $stripalt, "smalllinkimage3", $searchrow[PopUpPg3]);
-
Optional: If you want to include all three pop ups, add the code:
if (!empty($display_imglink2)) echo $display_imglink2; if (!empty($display_imglink3)) echo $display_imglink3;
Just under the lines:
if (!empty($display_imglink1)) echo $display_imglink1;
-
Save and reload the files.