Quantcast
Channel: Developer to developer
Viewing all articles
Browse latest Browse all 9076

DisplayName not saved and variant not published when creating variant for language branch

$
0
0

Hi!

This is my code:

var variant = _contentRepository.GetDefault<Variant>(productRef);
variant.Name = "Name";
variant.DisplayName = "Name sv";
var vaRef = _contentRepository.Save(variant, SaveAction.Publish, AccessLevel.NoAccess);
var noVariant = _contentRepository.CreateLanguageBranch<Variant>(vaRef, CultureInfo.GetCultureInfo("no"));
noVariant.Name = "Name";
noVariant.DisplayName = "Name no";
_contentRepository.Save(noVariant, SaveAction.Publish, AccessLevel.NoAccess);

What happens is that I get two variants, but the variant for the no language is not published and is missing DisplayName?
I can publish the variant from the GUI without problem.

Any idea why this is happening?

Thanks!

/Kristoffer


Viewing all articles
Browse latest Browse all 9076

Trending Articles