Hi,
Product option is special type of product, but still, you can have image for product option as well as for product. Product options as well as products are stored in
COM_SKU table in database and by default, product image paths are stored in
SKUImagePath column for each record in this table, so when editing your product option in UI of Kentico CMS, you can either upload or select some image to be associated with your product option.
What you need to do in order to display your product option images is to modify
ProductOptionSelector control for this purpose:
~\CMSModules\Ecommerce\Controls\ProductOptions\ProductOptionSelector.ascx.csIn
LoadSelector method in this file, you can check type of the product option category (in this case I’m modifying CheckBoxesHorizontal layout) and then for each product option (product) you can get image path and display the image according your needs. Example:
switch (this.OptionCategory.CategorySelectionType)
{
case OptionCategorySelectionTypeEnum.CheckBoxesHorizontal:
LocalizedCheckBoxList boxListHorizontal = (LocalizedCheckBoxList)this.SelectionControl;
foreach (ListItem item in boxListHorizontal.Items)
{
if (item != null)
{
SKUInfo sku = SKUInfoProvider.GetSKUInfo(ValidationHelper.GetInteger(item.Value, 0));
if (sku != null && !string.IsNullOrEmpty(sku.SKUImagePath))
{
item.Text += " <img alt=\"" + sku.SKUName + "\" src=\"" + UrlHelper.ResolveUrl(sku.SKUImagePath) + "\" width=\"50\" height=\"50\" />";
}
}
}
break;
}
I hope this will point you to right direction.
Best regards,
Miro Remias.