Try our conversational search powered by Generative AI!

Add properties to CatalogContent


My requirement is to add some properties inside the Catalog. Such as Meta tag related properties inside the catalog. So, the editors will be able to change the meta tags in Catalog.
I have tried to do this by defining a content type as mentioned in here by extending the CatalogContent. But the CatalogContent could not be inherited as mentioned in the documentation.

So I am wondering how can I add properties to Catalog which will be displayed in the Commerce edit view for Catalog content. Any input on this is appreciated. :)

Note: A similar question is asked in 2018. But it does not mention a way to add properties inside the Catalog itself (It mentioned a workaround to this by storing the additional properties elsewhere. But I need to include those properties inside the Catalog. So, editors could browse the relevant catalog and add content).


Edited, Apr 18, 2023 8:43

Yes I see that as soon as you add CatalogContentType to any extending class it errors.

I've always tended to build the site settings as a separate assets area for all settings across including commerce with a node for each grouping so that's an approach I'd suggest rather than trying to add them to the catalog.

Edited, Apr 18, 2023 10:43
- Apr 18, 2023 11:10
Hi Scott, Thanks for the input, But in our solution, we have already added additional properties to Categories, Products and Variations. So, editors could update Category, Product and Variation additional properties through Commerce edit mode (Optimizely Commerce edit mode -> Catalogs). So, having Catalog specific properties defined elsewhere is not intuitive in our solution perspective (Both the developer and editor perspective ). And since the site could have many Catalogs, it is cumbersome/over-kill to maintain the mapping elsewhere.

But, if there is no way to include additional properties inside the Catalog, then we have to find an alternative and we may have to consider the solution you have mentioned. But I will also contact Optimizely Support regarding this as I need to know is there any possible way to add properties inside the Catalog. As it will help immensely to simplify and uniform our implementation.
Scott Reed - Apr 18, 2023 12:01
Yes, that's very standard for the models you can extend. My current project has 40-50 properties on the products and variants and 10-20 on the category nodes which is pretty standard but sometimes there's not easy ways to do things in commerce as it's an amalgamation of CMS and the old media chase system. For example there's no way to order categories like you would in CMS therefore we had to replicate settings in the site settings that were leaf nodes linking to the category pages.

While it would be nice to add properties on the node as there's error messages when trying to do that it's decidedly not built to allow that. The only possible solution is having something at runtime to add them in via an init module or middleware but I don't think that will work. Let's see what support says

CatalogContent can't be extended. In fact it will throw exception if you try to.

There is a story to allow extending CatalogContent, but it is not of high priority and will probably not happen any time soon 

Apr 18, 2023 13:50
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.