Integrating Elevate Image Zoom (v. 2.83)

The current SiteBuilder system does not include an image zoom feature. If you would like to add an image zoom (with optional gallery for detail items), you can use the following modification to integrate the popular Elevate Zoom jQuery plugin. Please note that this modification has only been tested in version 2.83.

  1. Go to:

    http://www.elevateweb.co.uk/image-zoom

    and download the plugin.

  2. Create a /zoom/ folder in the public directory of your site.

  3. These instructions work for Elevate Zoom v. 3.0.8. If the version changes in the future, make sure to use the new version number in your code.

    Load the following files from the zip packet into the /zoom/ folder you just created:

    elevatezoom.jquery.json
    jquery.elevateZoom-3.0.8.min.js
    jquery.elevatezoom.js
    README.md
  4. Open the meta.php file in the /enc/ folder, and add the code:


    To the very bottom of the page, just under the ?> tag. (Note: make sure your templates use the meta.php include!)

  5. Open the products_variables.php file in the /enc/ folder, and add:

    // IMAGE ZOOM
    if (!function_exists("var_imgzoom"))
    {
    function var_imgzoom($idnum, $smallimg, $largeimg, $imgdata, $zoomparams='')
    {
    $zoomimg=$imgdata;
    if(!empty($largeimg))
    {
    $largeimg=imgpathtourl($largeimg);
    if($smallimg!=$largeimg)
    $zoomimg=str_replace("$("#zoom" .$idnum ."").elevateZoom($zoomparams);n";
    }
    return $zoomimg;
    }
    }

    if (!function_exists("var_lgimgzoom"))
    {
    function var_lgimgzoom($posid, $itmid, $large_img_val, $itemname)
    {
    global $urldir;
    $altname=str_replace('"', '', $itemname);
    $large_img_val=imgpathtourl($large_img_val);
    if(!empty($large_img_val))
    {
    $lgzoomimg="$altname";
    if($posid>0 AND $posid<4 AND !empty($itmid))
    $lgzoomimg="$altname
    ";
    }
    return $lgzoomimg;
    }
    }

    if (!function_exists("var_galleryzoom"))
    {
    function var_galleryzoom($itmid, $large_img_val, $itemname, $gallarray)
    {
    global $urldir;
    $altname=str_replace('"', '', $itemname);
    $large_img_val=imgpathtourl($large_img_val);
    if(!empty($large_img_val))
    {
    $lgzoomimg="$altname

    ";
    }
    return $lgzoomimg;
    }
    }
  6. To include a zoom on the 2-6 Column Layout, open the products_multiple.php file in the /enc/ folder, and change the lines:

    // DISPLAY PRODUCT IMAGES
    if (!empty($display_imglink1))
    >echo $display_imglink1;

    to:

    // DISPLAY PRODUCT IMAGES
    if(!empty($display_sm_image1))
    echo var_imgzoom($scount, $display_sm_image1, $searchrow[LgImage], $display_imglink1, "{zoomType:'lens', lensShape:'round', lensSize:200}");
  7. To include a zoom on the Single Product Layout, open the products_single.php file in the /enc/ folder, and change the lines:

    // DISPLAY IMAGES
    if (!empty($display_smimage1))
    echo $display_smimage1;
    if (!empty($display_smimage2))
    echo $display_smimage2;
    if (!empty($display_smimage3))
    echo $display_smimage3;
    if ((!empty($display_smimage1) OR !empty($display_smimage2) OR !empty($display_smimage3)) AND $display_zoom == "y")
    echo "$label_zoom";

    to:

    // DISPLAY IMAGES
    if(!empty($display_smimage1))
    echo var_imgzoom($searchrow[0] .'-1', $display_sm_image1, $searchrow[LgImage], $display_smimage1, "{zoomType:'lens', lensShape:'round', lensSize:200, scrollZoom:true}");
    if(!empty($display_smimage2))
    echo var_imgzoom($searchrow[0] .'-2', $display_sm_image2, $searchrow[LgImage2], $display_smimage2, "{zoomType:'lens', lensShape:'round', lensSize:200, scrollZoom:true}");
    if(!empty($display_smimage3))
    echo var_imgzoom($searchrow[0] .'-3', $display_sm_image3, $searchrow[LgImage3], $display_smimage3, "{zoomType:'lens', lensShape:'round', lensSize:200, scrollZoom:true}");
  8. To include a zoom on the Double/Triple Product Layout, open the products_multisingle.php file in the /enc/ folder, and change the lines:

    // DISPLAY IMAGES
    if (!empty($display_smimage1))
    echo $display_smimage1;
    if (!empty($display_smimage2))
    echo $display_smimage2;
    if (!empty($display_smimage3))
    echo $display_smimage3;

    to:

    // DISPLAY IMAGES
    if(!empty($display_smimage1))
    echo var_imgzoom($searchrow[0] .'-1', $display_sm_image1, $searchrow[LgImage], $display_smimage1, "{zoomType:'lens', lensShape:'round', lensSize:200, scrollZoom:true}");
    if(!empty($display_smimage2))
    echo var_imgzoom($searchrow[0] .'-2', $display_sm_image2, $searchrow[LgImage2], $display_smimage2, "{zoomType:'lens', lensShape:'round', lensSize:200, scrollZoom:true}");
    if(!empty($display_smimage3))
    echo var_imgzoom($searchrow[0] .'-3', $display_sm_image3, $searchrow[LgImage3], $display_smimage3, "{zoomType:'lens', lensShape:'round', lensSize:200, scrollZoom:true}");
  9. To include a zoon in the Detail Item Layout:

    1. Download the Large Image Sizer. This file will take the Large Image URL and resize it to a specific height and width, to use in your detail item page.

    2. Optional! Open the imgdetail.php file in a text editor, and if desired, change the following:

      • $lgwidth=600;
        Change to the 1000, or the maximum pixel width at which you would like your large image to display.
      • $lgheight=400;
        Change to 1000, or the maximum pixel height at which you would like your large image to display.
      • $img_crop='n';
        Optional: change to 'y' if you want to crop the image (starting at the top left corner).
        Change to 'n' to resize the image to the above maximum sizes.
      • $img_sharpen='y';
        Optional: change to 'y' if you want to sharpen the image after resizing it.
        Change to 'n' if you do not want to sharpen the image.
      • $background_color='FFFFFF';
        Change the FFFFFF to the background color that will show under resized images.
    3. Load this imgdetail.php file into the /images/ folder of your site.

    4. Open the products_detail.php file in the /enc/ folder.

    5. Change the code

      // LARGE IMAGES
      if (!empty($display_lgimage1))
      echo "$display_lgimage1";
      if (!empty($display_lgimage2))
      echo "$display_lgimage2";
      if (!empty($display_lgimage3))
      echo "$display_lgimage3";

      to one of the following:

      • To show all images, and zoom the images, change to:

        // LARGE IMAGES
        if(!empty($display_lg_image1) OR !empty($display_lg_image2) OR empty($display_lg_image3))
        {
        echo var_lgimgzoom('1', $searchrow[ID], $display_lg_image1, $searchrow[Item]);
        echo var_lgimgzoom('2', $searchrow[ID], $display_lg_image2, $searchrow[Item]);
        echo var_lgimgzoom('3', $searchrow[ID], $display_lg_image3, $searchrow[Item]);
        echo "";
        }
      • OR: To show a zoom gallery (main image with zoom, and thumbnails underneath), change to:

        // LARGE IMAGES
        if (!empty($display_lg_image1))
        {
        echo "";
        // GALLERY
        $galleryimgs = array();
        for($ig=1; $ig<=3; ++$ig)
        {
        $displimg = ${'display_lg_image'.$ig};
        $dispthumb = ${'display_sm_image'.$ig};
        if (!empty($displimg) AND !empty($dispthumb))
        $galleryimgs[$ig] = "n";
        }
        echo var_galleryzoom($searchrow[ID], $display_lg_image1, $searchrow[Item], $galleryimgs);
        echo "";
        }
  10. Optional! If you would like to configure the zoom, you can replace the configuration in brackets in the above call:

    {zoomType:'lens', lensShape:'round', lensSize:200}

    with any configuration options shown on the elevate zoom site:

    http://www.elevateweb.co.uk/image-zoom/examples

    For instance, to allow a user to zoom with a mouse wheel, you can use:

    {scrollZoom:true}