Class ProductItemCollection
- Namespace
- Dynamicweb.Ecommerce.Products
- Assembly
- Dynamicweb.Ecommerce.dll
Represents a collection of ProductItem objects.
[Serializable]
public class ProductItemCollection : Collection<ProductItem>, IList<ProductItem>, ICollection<ProductItem>, IReadOnlyList<ProductItem>, IReadOnlyCollection<ProductItem>, IEnumerable<ProductItem>, IList, ICollection, IEnumerable
- Inheritance
-
ProductItemCollection
- 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);
}
}
}
}
}
}
Remarks
Add, Remove, Get an item; Load items from database.
Constructors
ProductItemCollection()
public ProductItemCollection()
ProductItemCollection(IEnumerable<ProductItem>)
public ProductItemCollection(IEnumerable<ProductItem> items)
Parameters
items
IEnumerable<ProductItem>
Methods
Load(string)
Fills a collection of ProductItem objects from database.
[Obsolete("Use getter methods on ProductItem, or Product.Items instead.")]
public void Load(string query)
Parameters
query
string- The SQL query.
Remove(string)
Removes the item from collection by ID.
public void Remove(string itemId)
Parameters
itemId
string- The item ID.