Try our conversational search powered by Generative AI!

Change MetaField property

Vote:
 

Hi Commerce forum

Our product catalog is manged by InRiver PIM and products are exported from PIM using a modified version of the InRiver adapter for Episerver. Under the hoods, it exports data in the Episerver format that Episerver then imports into the commerce catalog.

We hade an issue with one of the metafields originally being created with the wrong setting for MultiLanguage. It was created with false, but we needed it to be true. We first found out about this error when we had imported products into our catalog.

Exporting a new catalog from PIM didn't change the property. The export contained the MetaDataPlusBackup tag in the beginning of the XML, and in that section, the MultiLanguage property was changed to true. However that didn't change the setting of the MetaField. Changing the setting in Commerce Manger didn't change it either. No error message was shown in Commerce Manager, but the setting was just not changed.

I know that you can add the CatalogContentType attribute to a class and set properties for the MetaFields through attributes on members of this class. By adding or removing the [CultureSpecific] attribute to a member, it is actually possible to change the MultiLanguage setting on an existing MetaField. So somewhere in Episerver there exist code that can change properties of an existing MetaField :) But is this functionality exposed through a public API?

We would prefere not to use the CatalogContentType attribute, because if we use this feature a developer can actually change the MetaClass and MetaField settings that we would like to manage from PIM. That could cause strange errors if the PIM catalog structure and the Epieserver structure doesn't match.

Thank you for your input.

Regards

Anders

#173189
Dec 15, 2016 20:36
Vote:
 

Hi,

Are you using the strongly typed content types? Note that the attributes defined for strongly typed content types will rule - it will override other ways of settings such as by updating via CM.

In your case I would suggest you to add the CultureSpecific to the property, build the project then start the site. After the multiple language setting is set properly, you can safely remove the property and rebuild it project again.

Note that if you only remove the attribute but still keep the property then the metafield multi language setting will be reverted back.

/Q

#173201
Dec 16, 2016 0:30
Vote:
 

Would it be an option to remove the MetaField from episerver and export everything again from PIM?

As i recall it, changing to/from culture specific will mean data loss anyway.

#173223
Dec 16, 2016 9:49
Vote:
 

Thank you for your replies.


I ended up doing as Erik suggested. I removed the MetaField from the MetaClass (it was only used in 1 MetaClass), deleted the MetaField and then exported the catalog from PIM again. This created the MetaField again with the correct setting for MultiLanguage.

Quan, I expect your solution would also work, at least for the development environment (where the problem was). If the issue was in test or production, I gues the process for implementing that solution would be a bit more complex :)

I'm actually not sure if changing between CultureSpecific and not-CultureSpecific will result in loss of data. I think that when you change to non-culture specific, you will only be able to read and update content on the catalog default language. But when you change back to CultureSpecific again, I think the old information on the other languages will appear again (if it was saved before changing to non-culturespecific). So basically, I don't think Episerver deletes content when a metafield changes to non-culturespecific. Episerver just won't be able to access the data anymore. But I haven't testet this :)

Regards

Anders

#173225
Dec 16, 2016 9:59
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.