Try our conversational search powered by Generative AI!

Product Name and DisplayName not updated on programmatic save.

Vote:
 

i'm programitcially creating or updating products via a daily scheduled job, but currently when i set 'Name' and 'Display Name' of an exisiting product it's not taking effect, i'm not seeing any update to the product in the catalog once the job is done.

contentRepo.Save(productToChange, SaveAction.Publish | SaveAction.SkipValidation, AccessLevel.NoAccess);

I've seen the code setting the value in a debug session, but once saved, the changes aren't reflected in the UI. 'Create' is absolutely working, and have previously seen 'update' functionality working ok as well, but right now it's not updating. 

Any suggestions what the problem might be?

#253179
Apr 13, 2021 21:56
Vote:
 

How do you get the content? At first thought it looks like this, https://vimvq1987.com/icontentloader-getcontentlink-is-considered-harmful-for-catalog-content/ , but that should not apply to Name 

#253214
Apr 14, 2021 7:22
Vote:
 

Hi Quan, thank you for the response

that article suggests it's something to do with multiple languages? i believe the site is only in english at the moment, but i can try that suggestion, just a bit more info, i'm finding the product llike this:

var contentLink = referenceConverter.GetContentLink(sku);
var theItem = contentRepo.Get<EntryContentBase>(contentLink);

then if it's not empty i create a writeable clone:

productToChange = productToChange.CreateWritableClone<CustomProduct>();

so i'm going to try adding:

new LoaderOptions() { LanguageLoaderOption.MasterLanguage() }

as the article suggests.

#253220
Edited, Apr 14, 2021 8:36
Vote:
 

Hmm, so it's not it. The link I posted only applies in case of multiple languages.

I would suggest to turn on this Version gadget:

to make sure you are seeing the latest version in Catalog UI 

#253224
Apr 14, 2021 9:50
Vote:
 

Thanks Quan i can see that i am looking at the latest version of the product, can even see it's being updated by 'installer' like in your screenshot when my scheduled job updates the product, but none of the data is reflecting the change.

#253226
Apr 14, 2021 10:35
* 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.