Developer forum

Forum » Ecommerce - Standard features » Render product breadcrumb in feed

Render product breadcrumb in feed

Adrian Ursu Dynamicweb Employee
Adrian Ursu
Reply

Hi guys,

I have a situation where I need to integrate the shop with a local marketplace. they are asking for a feed that should contain, among other details, a complete breadcrumb for the product assignment. Something like this: Crăciun > Decorațiune de Crăciun > Coronițe de Crăciun

Is there any way I can accomplish this without killing the server? Keep in mind that the feed should output the details for a couple of thousand products.

Thank you,

Adrian


Replies

 
Nuno Aguiar Dynamicweb Employee
Nuno Aguiar
Reply

Hi Adrian,

 

You should be able to do this by using the Dynamicweb.Frontend.SearchEngineFriendlyURLs.GetFriendlyUrl() method and:

  • Getting the PrimaryOrFirstGroupId
  • Ensuring the GroupId has a primary page set OR sending to the GetPageByNavigationTag("Products") OR to a static page ID

 

That's at least how we've done it in the past in similar situations.

 

Best Regards,

Nuno Aguiar

 
Adrian Ursu Dynamicweb Employee
Adrian Ursu
Reply

Hi Nuno,

I already did that but it will only get me the direct parent of the product.

It is true that I can probably transform the friendly URL into a breadcrumb-like display but I have no way to tell where the groups start. Some pages might have a group-like name.
What I would need is a way to get the groups in the path. I can probably try and get the friendly name of the catalog page, the friendly name of the primary group, subtract them and transform whatever is left into a path.

I agree it is probably the most efficient way to generate it but I am not sure if I will always get a consistent outcome.

If there are no other options, I will probably have to make peace with this option :)

Thank you very much,

Adrian

 
Nuno Aguiar Dynamicweb Employee
Nuno Aguiar
Reply

Hi Adrian,

 

I guess that if you can get the proper breadcrumb generated in the product detail page, you can try to get the helper(s) that process the breadcrumb from that template and apply it to the template that generates the feed.

 

This may be easier said than done, but you can generate group path based on a groupId. If you use the API there's a PrimaryParentGroupId to find the parents tree/breadcrumb.

 

Best Regards,

Nuno Aguiar

 
Adrian Ursu Dynamicweb Employee
Adrian Ursu
Reply

Hi Nuno,

This sounds like an option.

Thank you,

Adrian

 

You must be logged in to post in the forum