Dynamicweb 8 Documentation
ProductItemCollection Class
Members  Example 

Represents a collection of ProductItem objects.
Object Model
ProductItemCollection ClassProductItem Class
Syntax
Remarks
Add, Remove, Get an item; Load items from database.
Example
Class BOMConfigurator
    Private template As Dynamicweb.Rendering.Template
    Private BOMProducts As ProductCollection
    Private Configurators As ProductItemCollection
    Private product As Product
 
    Public Sub SplitBOM()
       '  ### Split BOM items from configurators
        BOMProducts = New ProductCollection()
        Configurators = New ProductItemCollection()
        product = New Product()
        template = New Template()
 
        If template.LoopExists("BOMConfigurators") OrElse template.LoopExists("BOMProducts") Then
            For Each item As ProductItem In product.Items
                If item.BomGroupID = String.Empty Then
                    BOMProducts.Add(item.Products(0))
                Else
                    Configurators.Add(item)
                End If
           Next
        End If
    End Sub
End Class
class BOMConfigurator
{
   private Dynamicweb.Rendering.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);
               }
           }
       }
    }
}
Inheritance Hierarchy

System.Object
   System.Collections.ObjectModel.Collection<T>
      Dynamicweb.eCommerce.Products.ProductItemCollection

Requirements

Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

See Also

Reference

ProductItemCollection Members
Dynamicweb.eCommerce.Products Namespace

Send Feedback