how to show product options in same line

ramesh perera asked on February 23, 2015 13:25

hi how can i show products options with the same line which display product details in the gridview

Thanks

Recent Answers


Josef Dvorak answered on March 19, 2015 16:33

Hello Ramesh,

I am not completely sure by your scenario. Do you mean you would like to show the available product options next to the for example the Product name? This can be done by writing a custom transformation method and retrieving the list of available product options via the API:

// Get list of applicable Product Option Category IDs
var optionCategoryIDs = OptionCategoryInfoProvider.GetProductOptionCategories(skuid, true).Select<OptionCategoryInfo, int>(category => category.CategoryID);

InfoDataSet<SKUInfo> options = new InfoDataSet<SKUInfo>();

// Cycle through each category and build list of product option names
foreach (int categoryID in optionCategoryIDs)
{
    options.Merge(CMS.Ecommerce.VariantHelper.GetEnabledOptionsWithVariantOptions(skuid, categoryID));
}
0 votesVote for this answer Mark as a Correct answer

Martin Shin answered on June 4, 2015 20:34

Hi Josef. Your code doesn't work. Visual Studio returns error in var optionCategoryIDs = OptionCategoryInfoProvider.GetProductOptionCategories(skuid, true).Select<OptionCategoryInfo, int>(category => category.CategoryID); code. skuid unknown.

If I define skuid as integer, Visual Studio returns error in Select. Select method doesn't found in OptionCategoryInfo.

Is it possible to ask you about whole code?

Thank you.

Martin.

0 votesVote for this answer Mark as a Correct answer

Josef Dvorak answered on June 7, 2015 00:24

Hello Martin,

The Select method is part of the Linq library. You can enable it by adding using System.Linq; this to your code.

0 votesVote for this answer Mark as a Correct answer

Martin Shin answered on June 8, 2015 10:13

Hi Josef. Thank you for the answer. I tried call this method from macro in transformation. But I can't found where is method placed by Kentico. What is section where method would be found?

Martin

0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.