Page 1 of 1

Specific Product Load - Pull In Additional Image

Posted: Wed Nov 16, 2011 3:11 pm
by digdesigner
I would like to pull in an additional image from the AbleCommerce admin, similar to the way that the "Thumbnail Image" is pulled in. There is a bit of code in the SpecificProductLoad conlib that writes out the "thumbnail" url. I notice that there are multiple values for the standard images (eg. ThumbnailUrl, IconUrl, ImageUrl), but I was wondering if there is a value or property for the additional image similar to the others.

Code: Select all

string thumbURL = this.Page.ResolveClientUrl(_Product.ThumbnailUrl);
Thank you.

Re: Specific Product Load - Pull In Additional Image

Posted: Wed Nov 16, 2011 4:00 pm
by david-ebt
The additional images are in the "_Product.Images" ProductImageCollection. For each ProductImage in the ProductImageCollection there is another ImageUrl and ImageAltText.

So you could use this to determine if there are any additional images:

Code: Select all

int addImgCount = _Product.Images.Count;
If there are images, you can loop through the ProductImageCollection or just take the first one if you never have more one additional image.

Take a look at the Admin\Products\Assets\AdditionalImages.aspx control for more examples on how to access these images.