private async Task <string> PrettifyCategory(string categoryCommerceId, List <ViewProperty> properties, CommerceContext commerceContext) { string output = await categoryPathResolver.GetCategoryPath(commerceContext, categoryCommerceId); ViewProperty includeSubCategories = properties.FirstOrDefault(x => x.Name.EqualsOrdinalIgnoreCase("Hc_IncludeSubCategories")); if (includeSubCategories != null) { includeSubCategories.IsHidden = true; if (bool.TryParse(includeSubCategories.Value, out bool value) && value) { output += " " + Resources.IncludingSubCategories; } } return(output); }
private async Task AddReadOnlyFullPath(EntityView arg, CommercePipelineExecutionContext context, ViewProperty categorySelection) { if (categorySelection.RawValue != null && !string.IsNullOrEmpty(categorySelection.RawValue.ToString()) && categorySelection.RawValue.ToString().IndexOf("-Category-", StringComparison.OrdinalIgnoreCase) > 0) { var readOnlyProp = new ViewProperty { DisplayName = $"Full category path of '{categorySelection.RawValue}'", IsHidden = false, IsReadOnly = true, Name = "FullCategoryPath", IsRequired = false, OriginalType = "System.String", Value = await categoryPathResolver.GetCategoryPath(context.CommerceContext, categorySelection.RawValue.ToString()) }; arg.Properties.Insert(arg.Properties.IndexOf(categorySelection) + 1, readOnlyProp); } }