For some products, ContentRepository doesn't return data from the latest published version.
Code:
var productIdFromCommerce = 12345;
var contentRepository = ServiceLocator.Current.GetInstance();
var referenceConverter = ServiceLocator.Current.GetInstance();
var productLink = referenceConverter.GetContentLink(productIdFromCommerce, CatalogContentType.CatalogEntry, 0);
var productContent = contentRepository.Get(productLink);
Let's say the product has versions 1010, 1011, and 1012 available. The code above will return data for version 1010, instead of version 1012.
If I make changes to the product and publish changes (either from CM or the code), ContentRepository returns correct data (from version 1013).
The same code works fine for other products, so I first thought it's a caching issue, but I've restarted IIS several times, cleared cookies, browser data, etc.
Did anyone have the same problem?
A solution that worked for me was to use IContentVersionRepository and always fetch data from the latest published version.
If this happens on the lastest version (9.23) Please contact our developer support to file a bug for this. We will make sure it will be taken care of ASAP.
<p>Hi Quan,</p>
<p>I've upgraded EPiServer.Commerce to the latest version but I'm still having the same problem. I've created a new support task. Hope you can push things a bit :)</p>
Hi,
I have a project that is using EPiCommerce 9.14.1
For some products, ContentRepository doesn't return data from the latest published version.
Code:
Let's say the product has versions 1010, 1011, and 1012 available. The code above will return data for version 1010, instead of version 1012.
If I make changes to the product and publish changes (either from CM or the code), ContentRepository returns correct data (from version 1013).
The same code works fine for other products, so I first thought it's a caching issue, but I've restarted IIS several times, cleared cookies, browser data, etc.
Did anyone have the same problem?
A solution that worked for me was to use IContentVersionRepository and always fetch data from the latest published version.