Virtual Happy Hour this month, Jun 28, we'll be getting a sneak preview at our soon to launch SaaS CMS!

Try our conversational search powered by Generative AI!

How to update Available languages on CatalogContent?


Hi guys,

trying to programatically to update the Available languages for Catalog Content in a Sched.Job.

I have added a new Market and also the language in CMS (Admin -> Manage Website languages)

The Market is es-PA = Panama.

My code
var cloneCatalogCatalogLanguages = cloneCatalog.Property.Get("CatalogLanguages");
(cloneCatalogCatalogLanguages .Value as ItemCollection<string>).Add("es-PA"); 
cloneCatalogCatalogLanguages .Property.Set("CatalogLanguages", dd );
repository.Save(cloneCatalogCatalogLanguages , SaveAction.Publish);

When i go to the Catalog ( cms/Commerce/Catalog)

the Panama language is not checked and the page is not published???
What am i doing wrong?

Edited, Sep 12, 2019 10:42

you are doing it wrong, what you can do should be like this


repository.Save(cloneCatalog, SaveAction.Publish);

Assuming cloneCatalog is a writeable clone of your catalog content instance 

Sep 12, 2019 10:57

thx boss

Sep 12, 2019 10:58

Forgot to mention that you must have the new language enabled for your site. You can either use CMS => Admin => Manage Website Languages, or you can use ILanguageBranchRepository to do that programatically 

Sep 12, 2019 11:09

Did it already, thank you.

One last part, do not how i could activate the language in CMS, in code.
Let's say i get the start page (or root page) and activate the language and then sett fallback

Any clue what I-Interfaces could do that?

Sep 12, 2019 13:14

If I get your correctly then you want to set the fallback setting? If yes then you can look into ContentLanguageSettingRepository. You can load ContentLanguageSettings of a content, add or change the Fallback setting, then save it back

Sep 12, 2019 13:28

You did understand me correctly.
I have been searching for that repo for 2h.
Tried everything but, always started with ILang...., Isetti...., IContentLang....
But the Intelillisense did not give me any good hits.

Thanks Quan.

Sep 12, 2019 14:27
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.