Zoom - Professor Cloud Integration working fine

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
12 years ago
MikeMCSD wrote:
Thanks for both of the solutions, . . but both are having this problem:  it only works if there is more than one image.
If you have just one image for that Product, the zoom doesn't work.
Am I the only having this problem?


everyone having this problem =(
12 years ago
Hi,

I've probably misunderstood, but I have the solution "working" for one or more photos.  You can see one image at http://www.floralcollection.co.uk/products/121-handmade-pale-blue-heart-bomboniere.aspx, or with multiple images http://www.floralcollection.co.uk/products/40-silk-bridal-bouquets.aspx.

However, I do get the exception mentioned previously in the log every time a user visits the page.  The user doesn't see this exception though. I would dearly love to get rid of this!

Apologies if I've missed something.

Regards,

Alex.
12 years ago
Good news. I asked Atiq if he could help us out and he said ok.
He has it working perfectly in the great design he did here :

http://109.203.111.116:33307/products/123-signed-boss-orange.aspx

Can buy here : http://www.just4design.co.uk/add-ons.aspx
12 years ago
Hi,

I have implemented cloud zoom in the skin I am selling. For more information on skin please see this thread https://www.nopcommerce.com/boards/t/9887/premium-fashion-theme-with-additional-features-released.aspx

MikeMCSD asked me to share this cloudzoom with you guys as you are struggling so here is what you need to do;

Obvoiusly I don't need to mention that you need cloudzoom js and jquery on your page.

This is the code in onevariant.ascx for the image area part;

<div class="thump_listing">                  
                
               <asp:Literal ID="lImages" EnableViewState="false" runat="server"></asp:Literal>

                </div>
                <div id="sliderContent">
                    <asp:Literal ID="ltDefaultImage" EnableViewState="false" runat="server"></asp:Literal>                  
                </div>


the code file should have this code;

            var pictures = this.PictureService.GetPicturesByProductId(product.ProductId);
            if (pictures.Count > 0)
            {
                Size size;
                string defaultImageUrl = this.PictureService.GetPictureUrl(pictures[0], this.SettingManager.GetSettingValueInteger("Media.Product.DetailImageSizeWidth", 376), this.SettingManager.GetSettingValueInteger("Media.Product.DetailImageSizeHeight", 434), true, out size);
                string defaultImageAlternateText = String.Format(GetLocaleResourceString("Media.Product.ImageAlternateTextFormat"), product.LocalizedName);
                jqueryScript.AppendLine("<script type=\"text/JavaScript\" src=\"" + CommonHelper.GetStoreLocation() + "js/cloud-zoom.1.0.2.min.js\"></script>");                
                jqueryScript.AppendLine("<style type=\"text/css\">");
                jqueryScript.AppendLine(".jcarousel-skin-tango .jcarousel-container {");
                jqueryScript.AppendLine("height: " + (size.Height - 30) + "px;");
                jqueryScript.AppendLine("}");
                jqueryScript.AppendLine("</style>");

                string ZoomWidth = SettingManager.GetSettingValue("ProductDetails.ZoomWidth", "250");
                string ZoomHeight = SettingManager.GetSettingValue("ProductDetails.ZoomHeight", "200");
                string ZoomPosition = SettingManager.GetSettingValue("ProductDetails.ZoomPosition", "right");
                string ZoomX = SettingManager.GetSettingValue("ProductDetails.ZoomX", "10");
                string ZoomY = SettingManager.GetSettingValue("ProductDetails.ZoomY", "-4");
                string ZoomTint = SettingManager.GetSettingValue("ProductDetails.ZoomTint", "false");
                string ZoomTintOpacity = SettingManager.GetSettingValue("ProductDetails.ZoomTintOpacity", "0.5");
                string ZoomLensOpacity = SettingManager.GetSettingValue("ProductDetails.ZoomLensOpacity", "0.5");
                string ZoomSoftFocus = SettingManager.GetSettingValue("ProductDetails.ZoomSoftFocus", "false");
                string ZoomSmoothMove = SettingManager.GetSettingValue("ProductDetails.ZoomSmoothMove", "3");
                string ZoomShowTitle = SettingManager.GetSettingValue("ProductDetails.ZoomShowTitle", "true");
                string ZoomTitleOpacity = SettingManager.GetSettingValue("ProductDetails.ZoomTitleOpacity", "0.5");


                ltDefaultImage.Text = "<a href='" + this.PictureService.GetPictureUrl(pictures[0]) + "' class='cloud-zoom' id='zoom1' rel=\"zoomWidth: " + ZoomWidth + ", zoomHeight: " + ZoomHeight + ", position: '" + ZoomPosition + "', tint: " + ZoomTint + ", tintOpacity: " + ZoomTitleOpacity + ", lensOpacity: " + ZoomLensOpacity + ", softFocus: " + ZoomSoftFocus + ", smoothMove: " + ZoomSmoothMove + ", showTitle: " + ZoomShowTitle + ", titleOpacity: " + ZoomTitleOpacity + ", adjustX: " + ZoomX + ", adjustY:" + ZoomY + "\">";
                ltDefaultImage.Text += Environment.NewLine;
                ltDefaultImage.Text += "<img src=\"" + defaultImageUrl+ "\" alt='' title=\"" + defaultImageAlternateText + "\" />";
                ltDefaultImage.Text += "</a><table width=\"100%\"><tr><td align=\"left\"><b>" + GetLocaleResourceString("ProductDetails.RolloverImageText") + "</b></td><td align=\"right\"><a id=\"largehreflink\" target=\"_blank\" href=\"" + this.PictureService.GetPictureUrl(pictures[0]) + "\"><b>" + GetLocaleResourceString("ProductDetails.ViewLargeImage") + "</b></a></td></tr></table>";

                StringBuilder imgString = new StringBuilder();
                imgString.AppendLine("<ul id=\"mycarousel\" class=\"jcarousel jcarousel-skin-tango\">");
                int count = 0;
                
                foreach (Picture picture in pictures)
                {
                    count += 1;
                    imgString.AppendLine("<li style=\"margin-bottom:5px;\">");
                    string thumbPictureUrl = this.PictureService.GetPictureUrl(picture, this.SettingManager.GetSettingValueInteger("Media.Product.DetailImageThumbSizeWidth", 103), this.SettingManager.GetSettingValueInteger("Media.Product.DetailImageThumbSizeHeight", 90), true, out size);
                    string hiddenImageUrl = this.PictureService.GetPictureUrl(picture, this.SettingManager.GetSettingValueInteger("Media.Product.DetailImageSizeWidth", 376), this.SettingManager.GetSettingValueInteger("Media.Product.DetailImageSizeHeight", 434), true, out size);
                    string ImageAlternateText = String.Format(GetLocaleResourceString("Media.Product.ImageAlternateTextFormat"), product.LocalizedName);
                    imgString.AppendLine("<a href='" + this.PictureService.GetPictureUrl(picture) + "' class='cloud-zoom-gallery' title='" + ImageAlternateText+ "' rel=\"useZoom: 'zoom1', smallImage: '" + hiddenImageUrl + "' \">");
                    imgString.AppendLine("<img src=\"" + thumbPictureUrl + "\" alt=\"Thumbnail " + count + "\"/></a>");
                    imgString.AppendLine("</li>");
                }
                imgString.AppendLine("</ul>");
                lImages.Text = imgString.ToString();
            }
            else
            {
                Size size;
                string defaultImageUrl = this.PictureService.GetDefaultPictureUrl(PictureTypeEnum.Entity, this.SettingManager.GetSettingValueInteger("Media.Product.DetailImageSizeWidth", 0), this.SettingManager.GetSettingValueInteger("Media.Product.DetailImageSizeHeight", 434), out size);
                string defaultImageToolTip = String.Format(GetLocaleResourceString("Media.Product.ImageAlternateTextFormat"), product.LocalizedName);
                string defaultImageAlternateText = String.Format(GetLocaleResourceString("Media.Product.ImageAlternateTextFormat"), product.LocalizedName);
                ltDefaultImage.Text = "<img src=\"" + defaultImageUrl + "\" alt=\"" + defaultImageAlternateText + "\" />";
                lImages.Visible = false;
            }



The part in the code for .jcarousel-skin-tango .jcarousel-container is basically the slider on left side so you don't really need this for the zoom, you can change this according to your own slider.

I have stored all settings in settings for the zoom so it's easy to change.

Another javascript required on the page is this;

  <script type="text/javascript">

      jQuery(document).ready(function () {
          jQuery('#mycarousel').jcarousel({
              vertical: true,
              scroll: 1
          });
      });

      jQuery(function () {

          jQuery('.thump_listing ul li a').click(function () {
              var thisAttr = this;
              $("#largehreflink").attr("href", thisAttr);
          });
      });

  </script>

This is basically when you click any thumbnail, it gives the right href link to the main image.


Hopefully this would help some people.

If you are unable to put this in your project, please let me know, I would make this on default nop 1.9 installation so it's easy to understand for you guys.

Regards,
Atiq
12 years ago
A big Thank You to Atiq.
Using Atiq's great code, I got this thing to work.
First off, I'm not a master programmer or designer like Atiq, but was able to play around with the code to get it to work.
I made the thumbs appear below the main product image. Looks like this :
http://i185.photobucket.com/albums/x307/GaryNull/aProfZoom.gif
It's pretty easy to implement. I'll break down the steps.

In file : "\Templates\Products\OneVariant.ascx" :

First, comment out (or delete) these code lines :
<%--
<div class="picture">
<a runat="server" id="lnkMainLightbox"><asp:Image ID="defaultImage" runat="server" /></a>
<asp:ListView ID="lvProductPictures" runat="server" GroupItemCount="3">
<LayoutTemplate><table style="margin-top: 10px;"><asp:PlaceHolder runat="server" ID="groupPlaceHolder"></asp:PlaceHolder></table></LayoutTemplate>
<GroupTemplate><tr><asp:PlaceHolder runat="server" ID="itemPlaceHolder"></asp:PlaceHolder></tr></GroupTemplate>
<ItemTemplate><td align="left"><a href="<%#this.PictureService.GetPictureUrl((Picture)Container.DataItem)%>" rel="lightbox-p" title="<%= lProductName.Text%>">
<img src="<%#this.PictureService.GetPictureUrl((Picture)Container.DataItem, 70)%>" alt="Product image" /></a></td></ItemTemplate>
</asp:ListView></div>  --%>
And comment out the Script : <%-- <script language="javascript" type="text/javascript">function UpdateMainImage(url) . . . .


Then add this :
<script type="text/JavaScript" src="../Scripts/cloud-zoom.1.0.2.min.js"></script>
NOTE : put the script in the /Scripts folder.

<asp:Literal ID="ltDefaultImage" EnableViewState="false" runat="server"></asp:Literal><br />
<asp:Literal ID="lImages" EnableViewState="false" runat="server"></asp:Literal>


In file : "\Templates\Products\OneVariant.ascx.cs" :

First, comment out (or delete) these code lines :
Start from the comment "//pictures" in the function BindProductInfo() and comment out all the way down :  
//pictures
//var pictures = this.PictureService.GetPicturesByProductId(product.ProductId);
//if (pictures.Count > 1)
//{
//    defaultImage.ImageUrl = this.PictureService.GetPictureUrl(pictures[0], . . .
...........  skipped some code here,  . . just select the whole thing to the end of the function
//    var picture = product.DefaultPicture;
//    if (picture != null)
//    {
//        lnkMainLightbox.Attributes["href"] = this.PictureService.GetPictureUrl(picture);
//        lnkMainLightbox.Attributes["rel"] = "lightbox-pd";
//    }
//}

} // BindProductInfo() END

Then add this to the same location where the "//pictures" comment was :

            //pictures

            var pictures = this.PictureService.GetPicturesByProductId(product.ProductId);
            if (pictures.Count > 0)
            {
                ////////////////////////////////////////////////// MAIN PRODUCT PAGE IMAGE
                string defaultImageUrl = this.PictureService.GetPictureUrl(pictures[0], this.SettingManager.GetSettingValueInteger("Media.Product.DetailImageSize", 300));
                string defaultImageAlternateText = String.Format(GetLocaleResourceString("Media.Product.ImageAlternateTextFormat"), product.LocalizedName);
                string ZoomWidth = SettingManager.GetSettingValue("ProductDetails.ZoomWidth", "250");
                string ZoomHeight = SettingManager.GetSettingValue("ProductDetails.ZoomHeight", "200");
                string ZoomPosition = SettingManager.GetSettingValue("ProductDetails.ZoomPosition", "right");
                string ZoomX = SettingManager.GetSettingValue("ProductDetails.ZoomX", "10");
                string ZoomY = SettingManager.GetSettingValue("ProductDetails.ZoomY", "-4");
                string ZoomTint = SettingManager.GetSettingValue("ProductDetails.ZoomTint", "false");
                string ZoomTintOpacity = SettingManager.GetSettingValue("ProductDetails.ZoomTintOpacity", "0.5");
                string ZoomLensOpacity = SettingManager.GetSettingValue("ProductDetails.ZoomLensOpacity", "0.5");
                string ZoomSoftFocus = SettingManager.GetSettingValue("ProductDetails.ZoomSoftFocus", "false");
                string ZoomSmoothMove = SettingManager.GetSettingValue("ProductDetails.ZoomSmoothMove", "3");
                string ZoomShowTitle = SettingManager.GetSettingValue("ProductDetails.ZoomShowTitle", "false");
                string ZoomTitleOpacity = SettingManager.GetSettingValue("ProductDetails.ZoomTitleOpacity", "0.5");

                ltDefaultImage.Text = "<a href='" + this.PictureService.GetPictureUrl(pictures[0]) + "' target=\"_blank\" class='cloud-zoom' id='zoom1' rel=\"zoomWidth: " + ZoomWidth + ", zoomHeight: " + ZoomHeight + ", position: '" + ZoomPosition + "', tint: " + ZoomTint + ", tintOpacity: " + ZoomTitleOpacity + ", lensOpacity: " + ZoomLensOpacity + ", softFocus: " + ZoomSoftFocus + ", smoothMove: " + ZoomSmoothMove + ", showTitle: " + ZoomShowTitle + ", titleOpacity: " + ZoomTitleOpacity + ", adjustX: " + ZoomX + ", adjustY:" + ZoomY + "\">";
                ltDefaultImage.Text += "<img src=\"" + defaultImageUrl + "\" alt='' title=\"" + defaultImageAlternateText +
                                       "\" /><br />&nbsp;&nbsp;&nbsp;<span class=\"enlargeText\">Enlarge this Image</span></a>";
                ////////////////////////////////////////////////// ADDITIONAL THUMB IMAGES
                StringBuilder imgString = new StringBuilder();
                int count = 0;
                foreach (Picture picture in pictures)
                {
                    if (pictures.Count == 1 ) break;
                    string thumbPictureUrl = this.PictureService.GetPictureUrl(picture, this.SettingManager.GetSettingValueInteger("Media.DetailImageThumbSizeWidth", 65));
                    string hiddenImageUrl = this.PictureService.GetPictureUrl(picture, this.SettingManager.GetSettingValueInteger("Media.Product.DetailImageSize", 300));
                    string ImageAlternateText = String.Format(GetLocaleResourceString("Media.Product.ImageAlternateTextFormat"), product.LocalizedName);
                    imgString.Append("<a href='" + this.PictureService.GetPictureUrl(picture) +
                        "' class='cloud-zoom-gallery' title='" + ImageAlternateText + "' rel=\"useZoom: 'zoom1', smallImage: '" + hiddenImageUrl + "' \">");
                    imgString.Append("<div class=\"picBox\"><img src=\"" + thumbPictureUrl + "\" alt=\"Thumbnail " + count + "\"/></div></a>");
                }
                lImages.Text = imgString.ToString();
            }
            else
            {
                ////////////////////////////////////////////////// NO IMAGE
                string defaultImageUrl = this.PictureService.GetDefaultPictureUrl(PictureTypeEnum.Entity, 300);
                string defaultImageToolTip = String.Format(GetLocaleResourceString("Media.Product.ImageAlternateTextFormat"), product.LocalizedName);
                string defaultImageAlternateText = String.Format(GetLocaleResourceString("Media.Product.ImageAlternateTextFormat"), product.LocalizedName);
                ltDefaultImage.Text = "<img src=\"" + defaultImageUrl + "\" alt=\"" + defaultImageAlternateText + "\" />";
                lImages.Visible = false;
            }



Add these styles to the \App_Themes\darkOrange\styles.css file :

/* This is the moving lens square underneath the mouse pointer. */
.cloud-zoom-lens {border: 4px solid #888; margin:-4px;  /* Set this to minus the border thickness. */
  background-color:#fff; cursor:move;}
/* This is for the title text. */
.cloud-zoom-title {font-family:Arial, Helvetica, sans-serif; position:absolute !important; background-color:#000;
  color:#fff; padding:3px; width:100%; text-align:center;  font-weight:bold; font-size:10px; top:0px;}
/* This is the zoom window. */
.cloud-zoom-big {border:4px solid #ccc; overflow:hidden;}
/* This is the loading message. */
.cloud-zoom-loading {color:white; background:#222; padding:3px;  border:1px solid #000;}

.picBox {border:1px solid #000; width:70px; height:70px; float:left; padding:3px 3px; margin:12px 15px 10px 0px; vertical-align:middle;}
.enlargeText {font-size:14px;}
.enlargeText:hover { text-decoration:underline;}


Let me know if you have any questions.
Thanks again Atiq for sharing this.
.
12 years ago
This update for everyone who will use Zoom Professor Cloud on nopCommerce v2.0

https://www.nopcommerce.com/boards/t/10751/professor-cloud-integration-v20.aspx
12 years ago
@MikeMCSD

No problem, I am glad I was of any help. please give vote to my fashion thread, if you like it.

Regards,
Atiq
12 years ago
Don't forget to comment out the lines for the slim box because
you don't need it anymore when using Prof Zoom:

In files : "\Templates\Products\OneVariant.ascx.cs" and "\Modules\ProductInfo.ascx.cs" :


    protected override void OnPreRender(EventArgs e)
        {
            BindJQuery();

            //   string slimBox = CommonHelper.GetStoreLocation() + "Scripts/slimbox2.js";
            //  Page.ClientScript.RegisterClientScriptInclude(slimBox, slimBox);

            base.OnPreRender(e);
        }
10 years ago
Hello, I'm trying to add a placeholder img for items without an image but I'm not able to get that to work.
Here's what the code I'm working with. PLEASE HELP


On the back-end (aspx.vb)

zoom1.HRef = "cloud-zoom.1.0.2/large_" + Request.QueryString("Img")


Front-end (aspx)

<a class='cloud-zoom' id='zoom1' rel="adjustX: 10, adjustY:-4" runat="server">
<asp:Image ID="ProductImage" runat="server"></asp:Image>
</a>



-------------------------------------------
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.