I need help using the ProductOptionCollection or the ProductVariantCollection. is there any documentation on these? I need to figure out where the images are stored for the product options. I want to collect the URLS for the option images to be able to display them on my product page without using the 'swatches' feature. I'm trying to write a ConLib that will just display the option images below all of the product information. But I can't figure out how to get the images from the Product.
This is the start of the code I'm working with.... I'm new to this so I didn't know where to look for documentation:
Code: Select all
public partial class ConLib_OptionImages : System.Web.UI.UserControl
{
protected void Page_Load(object sender, EventArgs e)
{
DataTable dt = new DataTable();
dt.Columns.Add("ImagePath", typeof(String));
int _ProductId = AlwaysConvert.ToInt(Request.QueryString["ProductId"]);
Product _Product = ProductDataSource.Load(_ProductId);
if (_Product != null)
{
ProductImageCollection images = _Product.Images;
dt.Rows.Add(new Object[] { AlwaysConvert.ToString(_Product.ImageUrl) });
foreach (ProductImage theimage in images)
{
dt.Rows.Add(new Object[] { AlwaysConvert.ToString(theimage.ImageUrl) });
}
ProductOptionCollection productOptions = _Product.ProductOptions;
int optionCount = productOptions.Count;
for (int i = 0; i < optionCount; i++)
{
if (!string.IsNullOrEmpty(productOptions[i].ImageUrl))
{
dt.Rows.Add(new Object[] { AlwaysConvert.ToString(productOptions[i].ImageUrl) });
}
}
ImageList.DataSource = dt;
ImageList.DataBind();
}
}
}
How do I get from the ProductOption down to the individual images set for the different options?
Any help would be greatly appreciated!! Thanks!
Rhonda