Hi Matt,
The Product Options are not stored in SKU InfoObject. The main hurdle is that SKU can have multiple Product Option Categories assigned (Size, Color, Fit), which each may contain multiple SKU Product options ({S, M, L}, {Red, Blue, Green}, {Slim, Normal}). Therefore what you need to do is get all Product Option Categories assigned to the SKU and then get all SKU Product options from each category and return them in one DataSet or list.
Here is a sample method returning HTML list of all SKU Product Options based on SKUID:
private static string getProductOptions(int skuId)
{
if (skuId <= 0)
{
return null;
}
StringBuilder strReturn = new StringBuilder();
// Get all categories assigned to the SKU
InfoDataSet<OptionCategoryInfo> optionCategories = OptionCategoryInfoProvider.GetSKUOptionCategories(skuId, true);
if (!DataHelper.DataSourceIsEmpty(optionCategories))
{
InfoDataSet<SKUInfo> options = new InfoDataSet<SKUInfo>();
// Go through all Categories assigned to this SKU and add all Product Options from each category to the result set of all options.
foreach (OptionCategoryInfo item in optionCategories)
{
options.Items.Add(SKUInfoProvider.GetSKUOptions(item.CategoryID, true));
}
if (!DataHelper.DataSourceIsEmpty(options.Items))
{
strReturn.Append("<ul>");
// Process the list. You can do this in the previous step, if you do not need to process the set any other way.
foreach (SKUInfo item in options)
{
strReturn.Append("<li>" + item.SKUName + "</li>");
}
strReturn.Append("</ul>");
}
}
return strReturn.ToString();
}
Let me know if you need any further help.
Regards,
Josef Dvorak