AI OnAI Off
Log into the Commerce catalog. Then, navigate to the variant and click the Belongs to tab to see its path.
It is unclear what you are trying to do, but i assume you want to get the variant url
From the code you can use ReferenceConverter to get the content link
From the content link you can use UrlResolver.GetUrl to get the url of the content. In this case, the variant
We have created some EntryContentExtensions
that will help you to retrieve the PrimaryCategory
public static NodeContent GetCategory(this EntryContentBase entryContent, IContentLoader contentLoader = null)
{
return GetCategory<NodeContent>(entryContent, contentLoader);
}
Here is the method GetCategory<T>()
definitions
public static T GetCategory<T>(this EntryContentBase entryContent, IContentLoader contentLoader = null)
where T : NodeContent
{
if (entryContent == null)
return null;
if (contentLoader == null)
{
contentLoader = ServiceLocator.Current.GetInstance<IContentLoader>();
}
var nodeContent = contentLoader
.GetAncestors(entryContent.ContentLink)
.FirstOrDefault(x => x is T);
return nodeContent as T;
}
Let me know if it helps you.
Thanks
What you mentioned in the comment sounds like bread crumb. If that is the case, you can do like this https://leanpub.com/epicommercerecipes/read_sample (Recipe 1.9)
How to find Variant path which displayed in commerece catalog /product/variant.