Table of Contents

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

groupInfo GroupInfoViewModel

The 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.

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

group GroupInfoViewModel

The group to build the link for.

pageId int

The fallback CMS page ID to use when the group has no primary page configured.

usePrimaryGroupPageId bool

When true (the default), PrimaryPageId overrides pageId if it is greater than zero. Set to false to always use pageId.

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

model GroupInfoViewModel

The 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

groupInfos IEnumerable<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.

See Also

To top