Hi Master Yoda,
Thanks for the reply. I suppose I am too old to begin the training.
I am actually using a modified ProductImageEx.ascx.cs file that I found here on this board at:
viewtopic.php?f=47&t=9071
I've got it working well on my development site:
http://dev.euroluxantiques.com/Vintage- ... -P662.aspx
I've added the script tags to the ProductImageEx.ascx file on the first line.
I pasted in your changes for the other line, but it is still blowing up on me.
I thought maybe the difference was that your change is for the original ProductImage.ascx, so I tested there and was still having basically the same problem. It looks like a syntax error. Unfortunately, I'm not real good with ASP/Javascript, yet. I'm more used to VB.NET and am trying to learn on the fly, so troubleshooting these things is hard for me still.
This is the ProductImageEx.ascx.cs code file I'm using.
Code: Select all
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Text.RegularExpressions;
using CommerceBuilder.Products;
using CommerceBuilder.Utility;
public partial class ConLib_MoreImagesEx : System.Web.UI.UserControl
{
//can be icon, thumbnail, or image
private string _ShowImage = "Thumbnail";
private bool _IncludeAdditionalImages = true;
private Product _Product;
private int _ProductId;
[Personalizable(), WebBrowsable()]
public string _largeImage
{
get { return _largeImage; }
set { _largeImage = Regex.Replace(_Product.ImageUrl,"00000001","FullSize"); }
}
public string ShowImage
{
get { return _ShowImage; }
set { _ShowImage = value; }
}
[Personalizable(), WebBrowsable()]
public bool IncludeAdditionalImages
{
get { return _IncludeAdditionalImages; }
set { _IncludeAdditionalImages = value; }
}
protected void Page_Load(object sender, EventArgs e)
{
_ProductId = AlwaysConvert.ToInt(Request.QueryString["ProductId"]);
_Product = ProductDataSource.Load(_ProductId);
ButtonPanel.Visible = (_IncludeAdditionalImages && _Product.Images.Count > 0);
if (!Page.IsPostBack)
{
if (_Product != null)
{
LiteralControl productImage = GetProductImage();
if(productImage!=null)
phProductImage.Controls.Add(productImage);
}
CurrentImageIndex.Value = "-1";
}
}
protected void NextImageButton_Click(object sender, EventArgs e)
{
int imageIndex = AlwaysConvert.ToInt(CurrentImageIndex.Value);
if (imageIndex < (_Product.Images.Count - 1))
imageIndex++;
ProductImage productImage = _Product.Images[imageIndex];
phProductImage.Controls.Clear();
phProductImage.Controls.Add(new LiteralControl("<a id=\"imgtag\" href=\"" + Page.ResolveClientUrl(_largeImage) + "' class=\"MagicMagnify\"><img id=\"ProductImage\" src=\"" + Page.ResolveClientUrl(productImage.ImageUrl) + "\" border=\"0\" alt=\"" + Server.HtmlEncode(productImage.ImageAltText) + "\" /></a>"));
CurrentImageIndex.Value = imageIndex.ToString();
}
protected void PreviousImageButton_Click(object sender, EventArgs e)
{
int imageIndex = AlwaysConvert.ToInt(CurrentImageIndex.Value);
if (imageIndex > -1)
imageIndex--;
if (imageIndex > -1)
{
ProductImage productImage = _Product.Images[imageIndex];
phProductImage.Controls.Clear();
phProductImage.Controls.Add(new LiteralControl("<a id=\"imgtag\" href=\"" + Page.ResolveClientUrl(_largeImage) + "' class=\"MagicMagnify\"><img id=\"ProductImage\" src=\"" + Page.ResolveClientUrl(productImage.ImageUrl) + "\" border=\"0\" alt=\"" + Server.HtmlEncode(productImage.ImageAltText) + "\" /></a>"));
}
else
{
LiteralControl productImage = GetProductImage();
if (productImage != null)
phProductImage.Controls.Add(productImage);
}
CurrentImageIndex.Value = imageIndex.ToString();
}
protected LiteralControl GetProductImage()
{
string checkImage = this.ShowImage.ToLowerInvariant();
string imageUrl;
string imageAltText;
if (checkImage == "icon")
{
imageUrl = _Product.IconUrl;
imageAltText = _Product.IconAltText;
}
else if (checkImage == "thumbnail")
{
imageUrl = _Product.ThumbnailUrl;
imageAltText = _Product.ThumbnailAltText;
}
else
{
imageUrl = _Product.ImageUrl;
imageAltText = _Product.ImageAltText;
}
if (!string.IsNullOrEmpty(imageUrl))
{
return new LiteralControl("<a id=\"imgtag\" href=\"" + Page.ResolveClientUrl(_largeImage) + "' class=\"MagicMagnify\"><img id=\"ProductImage\" src=\"" + Page.ResolveClientUrl(productImage.ImageUrl) + "\" border=\"0\" alt=\"" + Server.HtmlEncode(productImage.ImageAltText) + "\" /></a>");
}
return null;
}
}
It seems to me that they're declaring the variables near the bottom of the page. If that's correct, I'm thinking I would add the following lines:
string _LargeUrl --added after the other 2 variables already declared
_LargeUrl = '
http://www.euroluxantiques.com/Merchant2/graphics/Large' --added to the if, else if, and else statements
My question is, what appends the actual image file name to this URL variable, i.e., 10-102-01.jpg
Sorry if this is too basic, but I'm trying to figure out the whole AbleCommerce format and how it all works under the hood.
Thanks much!!!