SaaS CMS has officially launched! Learn more now.

Details about the Url to a product


Hi Commerce Forum

I would like some details about the best way of getting the Url to a product details page.

We use Solr for searching, and as part of the search results, we get back the Id to a product (actually a variant). We then use this code for getting the Url to the product details page:

var productLink = _referenceConverter.GetContentLink(productIdFromCommerce, CatalogContentType.CatalogEntry, 0);
doc.Url = _urlResolver.GetUrl(productLink, language);

Is this the best way of getting the Url, or is there some better/faster way to load the Url? We use the hierarchical way of generating product Url's, so the Url also contains information about the product hierarchy.

A number of our products are related to multiple Catalog Nodes. We have one branch of the catalog node hierarchy that contains all products, and other branches that contains a subset of products related to a specific business area. We would like that the search results generate the url to the "All products" branch of our product hierarchy. How do we ensure that?

Our product catalog is maintained in InRiver PIM and imported using the InRiver PIM adapter. Basically this adapter exports a Catalog.xml file corresponding to the format that can be imported by Episerver. Is there some way that we can specify from PIM, which branch of our catalog hierarchy that is used for generating product Url's? I know that there is a SortOrder in the NodeEntryRelations table, and this SortOrder can be set in the Catalog.xml file. Is this sort order used when the Url is generated? Is this logic documented somewhere?

Thank you for your help.



Feb 08, 2017 10:09


Currently the first NodeEntryRelation (the one with smallest SortOrder) will be considered the true "Parent" of the entry. So when you get the url of the entry, that node will be used. For now you can just set the main relation's SortOrder to 0 and the other ones to bigger values.

I'm not sure if this is documented somewhere. But we will improve this in next major version of Commerce.



Feb 08, 2017 11:02

Hi Quan

Thank you for your reply. That was the confirmation that I was looking for.



Feb 08, 2017 11:08
* 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.