Five New Optimizely Certifications are Here! Validate your expertise and advance your career with our latest certification exams. Click here to find out more

Read the "Belongs To" product tab property details

Vote:
 

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.

#189483
Mar 20, 2018 10:37
Vote:
 

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

#189491
Mar 20, 2018 11:19
Vote:
 

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.

#189497
Mar 20, 2018 12:59
Vote:
 

But Quan,

I need to create relations with tab manually.

I need some blogs explanations.

#189499
Mar 20, 2018 13:01
Vote:
 

https://world.episerver.com/documentation/developer-guides/commerce/catalogs/catalog-content/Categorizations/

should be pretty clear.

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

#189533
Mar 20, 2018 15:03
Vote:
 

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);
            relationRepository.UpdateRelation(relation);

Thank you

#189551
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.