Try our conversational search powered by Generative AI!

How to synchronize fields "DisplayName" and "Name in Url"



I have a problems with synchronization fields "DisplayName" and "Name in Url".(Episerver-commerce-catalog). I want that field "Name in Url" was formed by using field "DisplayName". How is it do better?

Dec 12, 2014 13:08

I work with Episerver 7.5 and MVC

Dec 12, 2014 13:12

When you manually edit the product, you can clear "Name in URL" and it will automatically be calculated from Name when you publish. There is no connection between Display name and Name though.

Dec 16, 2014 15:44

I resolved this issue so:

1. Add additional fields to form(commerce - catalog - new -category). - Inherite from class NodeContent and add properties with attribute [Required].

2. Subscribe to events CreatedContent of IContentEvents.

3. Checke that e.Conten is MyNodeContent.

4. GetLanguageBranches and CreateWritableClone

5. Change fields "Display Name" and "Name in Url" using values of additional fields and save(myRepository.Save)

Dec 20, 2014 13:58
* 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.