Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save asmagin/e5347eaaa7cea566b20281bd4b5871ef to your computer and use it in GitHub Desktop.
Save asmagin/e5347eaaa7cea566b20281bd4b5871ef to your computer and use it in GitHub Desktop.
Sitecore Catalog Module for Habitat
/// <summary>
/// An action to manage data for the ProductList
/// </summary>
/// <param name="pageNumber">The page number.</param>
/// <param name="facetValues">The facet values.</param>
/// <param name="sortField">The sort field.</param>
/// <param name="sortDirection">The sort direction.</param>
/// <returns>
/// The view that represents the ProductList
/// </returns>
public ActionResult MultipleProductLists(
[Bind(Prefix = StorefrontConstants.QueryStrings.Paging)] int? pageNumber,
[Bind(Prefix = StorefrontConstants.QueryStrings.Facets)] string facetValues,
[Bind(Prefix = StorefrontConstants.QueryStrings.Sort)] string sortField,
[Bind(Prefix = StorefrontConstants.QueryStrings.SortDirection)] CommerceConstants.SortDirection? sortDirection)
{
var productSearchOptions = new CommerceSearchOptions
{
NumberOfItemsToReturn = StorefrontConstants.Settings.DefaultItemsPerPage,
StartPageIndex = 0,
SortField = sortField
};
var currentRendering = RenderingContext.Current.Rendering;
var datasource = currentRendering.Item;
var viewModel = _catalogRepository.GetMultipleProductList(datasource, currentRendering, productSearchOptions);
return View("ProductRecommendation", viewModel);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment