Table of Contents

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
{
    class BomConfiguratorSample
    {
        private Template _template;
        private ProductCollection _bomProducts;
        private ProductItemCollection _configurators;
        private Product _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 (item.BomGroupId == string.Empty)
                    {
                        _bomProducts.Add(item.Products[0]);
                    }
                    else
                    {
                        _configurators.Add(item);
                    }
                }
            }
        }
    }
}
To top