Cannot not update internal block property by setting Value

Vote:
 

Hi!

After upgrade to Commerce 11 I cannot update an internal block on a page by setting the propertyData.Value. The property looks ok before publishing, it has values but they doesn't show up in the Episerver edit after publish.

This is waht the Code used to look like:

var editableCommerceContent = commerceContent.CreateWritableClone();
var propertyData = editableCommerceContent.Property.First(x => x.PropertyDefinitionID == int.Parse(property.Key));
if (propertyData.Name == "SeoInformation")
{
    var newSeo = new SeoInformation();
    var seoValues = property.Value.Split(new[] { "" }, StringSplitOptions.None);
    if (seoValues[0] != "-")
    {
        newSeo.Title = seoValues[0];
    }

    if (seoValues[1] != "-")
    {
        newSeo.Description = seoValues[1];
    }

    if (seoValues[2] != "-")
    {
        newSeo.Keywords = seoValues[2];
    }

    propertyData.Value = newSeo;
}
_contentRepository.Save(editableCommerceContent, SaveAction.Publish | SaveAction.SkipValidation, AccessLevel.NoAccess);

This used to work just fine but after upgrade the values are not published.

Has something changed or maybe I am missing something?

Thanks!

/Kristoffer

#187724
Feb 01, 2018 11:39
Vote:
 

I might be missing the big picture here, but why don't you access the SeoInformation directly. Would be easier that way

Pseudo code:

var seoInfo = commerceContent as ISearchEngineInformation;

if(seoInfo != null)

{

 seoInfo.SeoInformation.Title = "...";

//save stuffs

}

#187791
Feb 02, 2018 13:41
Vote:
 

The commerceContent is a variant or product and the SeoInformation is internal block property on that product or variant.

var seoInfo = commerceContent as ISearchEngineInformation;

Wouldn't that give me just null? I can't think that that line of code would give me the property SeoInformation from the commerceContent?

This is a part of a tranlations plugin so I do not always know the name of the property of type SeoInformation, it could be anyting.

#187794
Feb 02, 2018 14:03
Vote:
 

No it's not an internal block. It's from ISearchEngineInformation, which is implemented by EntryContentBase and NodeContent. If your commerceContent is defined as a CatalogContentBase then it's not publicly visible (may be that's why), but if you defined it as EntryContentBase or one of the derived classes, you should be fine. 

#187799
Feb 02, 2018 14:45
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.