Class GroupInfoViewModelExtensions
- Namespace
- Dynamicweb.Ecommerce.ProductCatalog
- Assembly
- Dynamicweb.Ecommerce.dll
Extension methods for GroupInfoViewModel and collections of it.
public static class GroupInfoViewModelExtensions
- Inheritance
-
GroupInfoViewModelExtensions
- Inherited Members
Methods
GetGroup(GroupInfoViewModel)
Loads the full ProductGroupViewModel for this group using the current page context settings.
public static ProductGroupViewModel? GetGroup(this GroupInfoViewModel groupInfo)
Parameters
groupInfoGroupInfoViewModelThe lightweight group reference to expand.
Returns
- ProductGroupViewModel
A fully populated ProductGroupViewModel when the group can be found and the current page has product view model settings available; otherwise null.
GetGroupLink(GroupInfoViewModel, int, bool)
Builds the navigation URL for a group, using the group's configured primary page when available.
public static string GetGroupLink(this GroupInfoViewModel group, int pageId, bool usePrimaryGroupPageId = true)
Parameters
groupGroupInfoViewModelThe group to build the link for.
pageIdintThe fallback CMS page ID to use when the group has no primary page configured.
usePrimaryGroupPageIdboolWhen true (the default), PrimaryPageId overrides
pageIdif it is greater than zero. Set to false to always usepageId.
Returns
- string
A relative URL string (e.g.
"Default.aspx?ID=42&GroupID=GROUP1").
GetSubGroups(GroupInfoViewModel)
Returns the immediate child groups of this group as lightweight GroupInfoViewModel instances.
public static IEnumerable<GroupInfoViewModel> GetSubGroups(this GroupInfoViewModel model)
Parameters
modelGroupInfoViewModelThe parent group whose subgroups to retrieve.
Returns
- IEnumerable<GroupInfoViewModel>
An enumerable of GroupInfoViewModel for each direct child group, or an empty enumerable when the group has no children or cannot be found.
SimplePath(IEnumerable<GroupInfoViewModel>)
Builds a breadcrumb-style path string from a sequence of groups by joining their names with /.
public static string SimplePath(this IEnumerable<GroupInfoViewModel> groupInfos)
Parameters
groupInfosIEnumerable<GroupInfoViewModel>The ordered sequence of group info view models representing the path from root to leaf.
Returns
- string
A
/-separated string of group names (e.g."Clothing/Men/Jackets"), or an empty string when the sequence is empty.