Try our conversational search powered by Generative AI!

Read the "Belongs To" product tab property details


Hi guys,

I have a small doubt related to the "Belongs To" tab in the Episerver commerce catalog.

Is there any API is available to create it manually.

Mar 20, 2018 10:37

What do you mean "create" it, "manually"? The tab or the relations within the tab? 

Mar 20, 2018 11:19

Hi Quan,

Thank you for the replay.

I need to get the referred product details by directly pass product id.

So that I decided to read the default "Belongs To" property.

Now I found the solution.

I used the IRelationRepository to get the referred product details.

The code,

var relationRepository = ServiceLocator.Current.GetInstance<IRelationRepository>();

 var contentlink = referenceConverter.GetContentLink(55, CatalogContentType.CatalogEntry, 0);

var testrelation = relationRepository.GetParents<NodeRelation>(contentlink);

Thank you.

Mar 20, 2018 12:59

But Quan,

I need to create relations with tab manually.

I need some blogs explanations.

Mar 20, 2018 13:01

should be pretty clear.

Create a new relation and call the UpdateRelation on the repository.

Mar 20, 2018 15:03

Hi Erik,

Thank you for the replay.

I created a new reference by using the following code.

            var Child = referenceConverter.GetContentLink(56, CatalogContentType.CatalogEntry, 0);
            var parent = referenceConverter.GetContentLink(1073741908, CatalogContentType.CatalogEntry, 0);

            //Add the product reference to one Category
            var relations = new NodeRelation  {
                               Child = Child,
                               Parent = parent
            var relation = (relations as Relation);

Thank you

Mar 20, 2018 15:25
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.