London Dev Meetup Rescheduled! Due to unavoidable reasons, the event has been moved to 21st May. Speakers remain the same—any changes will be communicated. Seats are limited—register here to secure your spot!

Add properties to CatalogContent (again)

Vote:
0

I am trying to add a property to my own CatalogContent.

Previous this topic was created: Add properties to CatalogContent | Optimizely Developer Community And was closed with "Not working".

Then I saw this blog post which says it can be done: https://stefanolsen.com/posts/catalog-roots-can-finally-be-customized-in-optimizely-commerce/ 

-

I can see my new property in the UI, and when the UI is reentered, I can still see the value I set. But I cannot read the value using code. I am trying to load the properties with something like this:

int catalogId = -2147483645;
_contentLoader.Get<MyCatalogContent>(_referenceConverter.GetContentLink(catalogId, CatalogContentType.Catalog, -1))

and 

var catalog = _contentLoader.GetAncestors(product.ContentLink)
	.OfType<MyCatalogContent>()
	.FirstOrDefault();

var x = catalog.MyProperty; // null

I can see the built in values, but not my own.

Any ideas how to read the value for my custom property?

#321586
May 06, 2024 9:06
Vote:
0

Hi Robert,

I think it is a bug from framework. Content Loader does not return latest published version by default. As I reviewed then you could get correctly only with specific version id.

You can raise a bug to support team to fix it.

#321702
May 08, 2024 8:08
Vote:
0

Hi Binh, 

Thanks for replying. It might be a bug, but due to time constraint we changed the feature we were building - to get the information elsewhere than from the Catalog.

#321938
May 13, 2024 6:50
Vote:
1

Can confirm this is a bug. I will report it to Commerce team, thanks for reporting it and apologies for the trouble it might have caused

#321959
May 13, 2024 11:18
Quan Mai - May 13, 2024 11:22
The bug is COM-18054 (not yet made public)
Vote:
0

Yes, I still see this issue in CMS 12.27.1 and Commerce 14.21

#322007
May 14, 2024 3:42
This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.
* 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.