Class ProductCollection
- Namespace
- Dynamicweb.Ecommerce.Products
- Assembly
- Dynamicweb.Ecommerce.dll
Represents a collection of the products.
[Serializable]
public class ProductCollection : Collection<Product>, IList<Product>, ICollection<Product>, IReadOnlyList<Product>, IReadOnlyCollection<Product>, IEnumerable<Product>, IList, ICollection, IEnumerable
- Inheritance
-
ProductCollection
- Implements
- Inherited Members
- Extension Methods
Examples
using Dynamicweb.Ecommerce.Products;
using Dynamicweb.Rendering;
namespace Dynamicweb.Ecommerce.Examples.Products;
public class BomConfiguratorSample
{
private Template _template = new Template();
private ProductCollection _bomProducts = new ProductCollection();
private ProductItemCollection _configurators = new ProductItemCollection();
private Product _product = new Product();
public void SplitBom()
{
//### Split BOM items from configurators
_bomProducts = new ProductCollection();
_configurators = new ProductItemCollection();
_product = new Product();
_template = new Template();
if (_template.LoopExists("BOMConfigurators") || _template.LoopExists("BOMProducts"))
{
foreach (ProductItem item in _product.Items)
{
if (string.IsNullOrEmpty(item.BomGroupId))
_bomProducts.Add(item.Products[0]);
else
_configurators.Add(item);
}
}
}
}