Link Thumbnail to Pop Up Link in Single, Double, Triple View (v. 2.8x)

When using the Single, Double or Triple product layout, clicking an image pops up a large image.

If you would like to change this so that clicking the image opens up a pop up page instead, 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.

  1. Open the products_variables.php file in the /enc/ folder.

  2. Find the var_smallimage function, around line 227.

  3. In that function, change the code:

    function var_smallimage($varimage, $varlgimage, $varimgclass, $varitem, $varalt, $vardefhw=400)

    to:

    function var_smallimage($varimage, $varlgimage, $varimgclass, $varitem, $varalt, $vardefhw=400, $varpop='')
  4. In that same function, add the code:

    // IF THERE IS A POPUP USE IT 
    if (!empty($varpop))
    $dispsmimage = "$smimg";
    else

    just above the code:

    // If there is a larger image, create clickable thumbnail
    if ($varlgimage)
  5. Open the products_single.php file (to change the Single Product View) and products_multisingle.php file (to change the Double/Triple Product View) in the /enc/ folder.

  6. Change the code:

    $display_smimage1 = var_smallimage($display_sm_image1, $searchrow[LgImage], "smallimage1", $stripitem, $stripalt);
    $display_smimage2 = var_smallimage($display_sm_image2, $searchrow[LgImage2], "smallimage2", $stripitem, $stripalt);
    $display_smimage3 = var_smallimage($display_sm_image3, $searchrow[LgImage3], "smallimage3", $stripitem, $stripalt);

    to:

    $display_smimage1 = var_smallimage($display_sm_image1, $searchrow[LgImage], "smallimage1", $stripitem, $stripalt, '', $searchrow[PopUpPg]);
    $display_smimage2 = var_smallimage($display_sm_image2, $searchrow[LgImage2], "smallimage2", $stripitem, $stripalt, '', $searchrow[PopUpPg2]);
    $display_smimage3 = var_smallimage($display_sm_image3, $searchrow[LgImage3], "smallimage3", $stripitem, $stripalt, '', $searchrow[PopUpPg3]);
  7. Optional: To remove the pop up links only for those that have images, change the lines:

    if (!empty($display_popup))
    echo "

    $display_popup

    ";
    if (!empty($display_popup2))
    echo "

    $display_popup2

    ";
    if (!empty($display_popup3))
    echo "

    $display_popup3

    ";

    to:

    if (!empty($display_popup) AND empty($display_smimage1))
    echo "

    $display_popup

    ";
    if (!empty($display_popup2) AND empty($display_smimage2))
    echo "

    $display_popup2

    ";
    if (!empty($display_popup3) AND empty($display_smimage3))
    echo "

    $display_popup3

    ";
  8. Save and reload the files.