Developer forum

Forum » Dynamicweb 10 » GetToplevelGroups is internal

GetToplevelGroups is internal

Imar Spaanjaars Dynamicweb Employee
Imar Spaanjaars
Reply

Hi there,

I have the following code from a DW 9 solution:

var langID = Pageview.Area.EcomLanguageId;
groups = Dynamicweb.Ecommerce.Services.ProductGroups.GetToplevelGroups(langID);
GetToplevelGroups and GetGroups are now internal in DW10. What's the equivalent I can use? Something like this?
Dynamicweb.Ecommerce.Services.ProductGroups.GetGroups().Where(theGroup => theGroup.IsTopGroup())
 
Imar

Replies

 
Morten Bengtson Dynamicweb Employee
Morten Bengtson
Reply
This post has been marked as an answer

You are right. The method on the group service is now internal - and it's not used anywhere, so it's dead code which we are going to remove.

I would suggest that you fetch the shop and then get the top level groups for that. Otherwise, you will get all top level groups for all shops (channel, warehouse, data structure, etc.).

var shop = Services.Shops.GetShop(shopId);
var topLevelGroups = shop.GetTopLevelGroups(languageId);
Votes for this answer: 1
 
Imar Spaanjaars Dynamicweb Employee
Imar Spaanjaars
Reply

Gotcha, thanks Morten!

 

You must be logged in to post in the forum