Skip to content

Instantly share code, notes, and snippets.

@sitefinitySDK
Created July 17, 2013 12:47
Show Gist options
  • Save sitefinitySDK/6020259 to your computer and use it in GitHub Desktop.
Save sitefinitySDK/6020259 to your computer and use it in GitHub Desktop.
SF_10.1, SF_10.2, SF_11.0, SF_11.1, SF_11.2, SF_12.0, SF_12.1, SF_12.2, SF_13.0, SF_13.1, SF_13.2, SF_13.3, SF_14.0, SF_14.1, SF_14.2, SF_14.3 - https://docs.sitefinity.com/for-developers-query-products-by-department
using System;
using System.Linq;
using Telerik.OpenAccess;
using Telerik.Sitefinity.Ecommerce.Catalog.Model;
using Telerik.Sitefinity.Model;
using Telerik.Sitefinity.Modules.Ecommerce.Catalog;
namespace Telerik.Sitefinity.Documentation.CodeSnippets.SitefinityEssentials.Modules.Ecommerce.Products
{
public partial class ProductsCodeSnippets
{
public static IQueryable<Product> GetProductsByDepartment(Guid departmentId)
{
CatalogManager catalogManager = CatalogManager.GetManager();
// Get all products that assigned to this department
IQueryable<Product> productsInDepartment = catalogManager.GetProducts()
.Where(p => p.GetValue<TrackedList<Guid>>("Department").Contains(departmentId));
return productsInDepartment;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment