Don't miss out Virtual Happy Hour this Friday (April 26).

Try our conversational search powered by Generative AI!

CatalogContentProperty not properly updated when saving non-published content

Found in

EPiServer.Commerce 10.0.0

Fixed in

EPiServer.Commerce 10.4.3

(Or a related package)

Created

Mar 06, 2017

Updated

Sep 21, 2017

Area

Core

State

Closed, Fixed and tested


Description

Steps to reproduce:

  1. Create a new content item without publishing it (leave it to Autosave).
  2. Update some properties and let it autosave again.
  3. Try to get the content by using the ContentReference without workId.
  4. Not-updated properties are returned.

Test case:

public class When_doing_something : IntegrationTest
{
private static ContentReference contentLink;
private static CommerceProviderSaveTestSku updatedContent;
private static string updatedRouteSegment = "updated-route-segment";
private static string updatedSeoUri = "updated-seo-uri.aspx";

private Establish context = () =>

{ var parentLink = ReferenceConverter.GetContentLink( CatalogTestHelper.DefaultCatalogNodeId, CatalogContentType.CatalogNode, 0); var content = ContentRepository.GetDefault<CommerceProviderSaveTestSku>(parentLink); content.Name = "MyName"; content.RouteSegment = updatedRouteSegment; content.SeoUri = updatedSeoUri; content.TestMetaString = "Original text"; content.MinQuantity = 1; content.MaxQuantity = 1; contentLink = ContentRepository.Save(content, SaveAction.Save, AccessLevel.NoAccess); content = ContentRepository.Get<CommerceProviderSaveTestSku>(contentLink).CreateWritableClone<CommerceProviderSaveTestSku>(); content.TestMetaString = "Updated text"; contentLink = ContentRepository.Save(content, SaveAction.Save, AccessLevel.NoAccess); updatedContent = ContentRepository.Get<CommerceProviderSaveTestSku>(contentLink.ToReferenceWithoutVersion()); }

;

It Should_have_a_specific_version =
() => updatedContent.TestMetaString.ShouldEqual("Updated text");
}

If there was no version yet, the data is saved to CatalogContentProperty table. However in the next save - because of "there is a version", data is saved to ecfVersionProperty.
When data is loaded from the "common draft" contentlink, it'll be loaded from CatalogContentProperty - causing the missing data.