Hello Stefan,
maybe you could try using a string property with SelectMany and a custom ISelectionFactory?
[CultureSpecific]
[SelectMany(SelectionFactoryType = typeof(ProductOptionsSelectionFactory))]
public virtual string ProductOptions { get; set; }
This selection factory could load the available options from a managed sources, for example a settings page or DDS, and return different option lists depending on the relevant site or catalog context. The selected values would then be stored as stable string keys on the catalog entry:
public class ProductOptionsSelectionFactory : ISelectionFactory {
private readonly IProductOptionsResolver _optionsResolver;
public ProductOptionsSelectionFactory(IProductOptionsResolver optionsResolver) {
_optionsResolver = optionsResolver;
}
public IEnumerable < ISelectItem > GetSelections(ExtendedMetadata metadata) {
return _optionsResolver.GetOptions(metadata).Select(x => new SelectItem {
Text = x.DisplayName, Value = x.Key
});
}
}
Since catalog content can be shared between sites, SiteDefinition.Current may not always point to the site you expect when editing a catalog entry. You may need to resolve the options from the catalog itself or use a catalog to site settings mapping
[CultureSpecific] creates separate values for each language, not for each site. If the same entry needs different selections on each site, you’ll need to store them separately.
I haven’t tested this exact setup, but it may be worth trying... and if you tried it out, please let me know how it went.
Kind Regards,
Wojciech
I have a solution that hosts two sites, each served in two languages.
The site owners now want to add a multi-select property to the product content type. They want to be able to maintain the list of select values, and they want the lists to be separate for the two sites.
I have looked at:
Any suggestions?