Table of Contents

Class ProductListViewModelExtensions

Namespace
Dynamicweb.Ecommerce.ProductCatalog
Assembly
Dynamicweb.Ecommerce.dll

Extension methods for ProductListViewModel that provide facet URL helpers and group navigation fallback logic.

public static class ProductListViewModelExtensions
Inheritance
ProductListViewModelExtensions
Inherited Members

Methods

GetSubOrRootGroups(ProductListViewModel)

Returns the sub-groups of the current group, or falls back to the shop's root groups based on the current page's ecommerce navigation settings.

public static IEnumerable<ProductGroupViewModel> GetSubOrRootGroups(this ProductListViewModel model)

Parameters

model ProductListViewModel

The product list view model.

Returns

IEnumerable<ProductGroupViewModel>
ConditionResult
SubGroups is non-emptyThe sub-groups of the active group.
Page navigation is set to specific groupsThose configured groups.
Page navigation is set to a shopThe top-level groups of that shop.
None of the aboveAn empty collection.

Use this in templates to render a group navigation without separate handling for root and sub-group levels:

@foreach (var group in Model.GetSubOrRootGroups())
{
    <a href="@group.GetGroupLink(Dynamicweb.Frontend.PageView.Current().ID)">@group.Name</a>
}

GetUriWithoutSelectedFacets(ProductListViewModel)

Gets the URI of the current page without the querystring parts of the selected facets. The returned URL can be used as a direct link to clear all selected facets of the search result. The returned URL can be used as action on the facet form that when submitted will only apply the new selection of facets

public static Uri GetUriWithoutSelectedFacets(this ProductListViewModel model)

Parameters

model ProductListViewModel

The product list view model.

Returns

Uri

The URI without the selected facets.

See Also

To top