Table of Contents

Class ProductItem

Namespace
Dynamicweb.Ecommerce.Products
Assembly
Dynamicweb.Ecommerce.dll

Represents information about product's item.

[Serializable]
public class ProductItem
Inheritance
ProductItem
Inherited Members

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);
                    }
                }
            }
        }
    }
}

Constructors

ProductItem()

Initializes a new instance of the ProductItem class.

public ProductItem()

Properties

BomGroupId

Gets or sets BOM group ID.

public string BomGroupId { get; set; }

Property Value

string

BomNoProductText

Gets or sets BOM product text.

public string BomNoProductText { get; set; }

Property Value

string

BomProductId

Gets or sets BOM product ID.

public string BomProductId { get; set; }

Property Value

string

BomUnitId

Gets or sets BOM unit ID.

public string BomUnitId { get; set; }

Property Value

string

BomVariantId

Gets or sets BOM variant ID.

public string BomVariantId { get; set; }

Property Value

string

DefaultProductId

Gets or sets default product ID.

public string DefaultProductId { get; set; }

Property Value

string

DefaultUnitId

Gets or sets default unit ID.

public string DefaultUnitId { get; set; }

Property Value

string

DefaultVariantId

Gets or sets default product variant ID.

public string DefaultVariantId { get; set; }

Property Value

string

Id

Gets or sets the item ID.

public string Id { get; set; }

Property Value

string

Name

Gets or sets the item name.

public string Name { get; set; }

Property Value

string

ProductId

Gets or sets the product ID.

public string ProductId { get; set; }

Property Value

string

Products

Gets or sets a collection of products.

public ProductCollection Products { get; set; }

Property Value

ProductCollection

Quantity

Gets or sets the quantity. If quantity = 0 then returns 1.0

public double Quantity { get; set; }

Property Value

double

The quantity.

Required

Gets or sets a value indicating whether this ProductItem is required.

public bool Required { get; set; }

Property Value

bool

true if required; otherwise, false.

SortOrder

Gets or sets the sort order.

public int SortOrder { get; set; }

Property Value

int

The sort order.

Methods

CheckGroup(string, string)

Checks the group is a product part.

public bool CheckGroup(string theProductId, string itemGroupId)

Parameters

theProductId string

DB field name is ProductItemProductID.

itemGroupId string

DB field name is ProductItemBomGroupID.

Returns

bool

true if group exist.

CheckProduct(string, string)

Checks the product item is exist.

public bool CheckProduct(string theProductId, string itemProductId)

Parameters

theProductId string

DB field name is ProductItemProductID.

itemProductId string

DB field name is ProductItemBomProductID.

Returns

bool

true if product exist.

CheckProduct(string, string, string)

Checks the product item is exist.

public bool CheckProduct(string theProductId, string itemProductId, string itemVariantId)

Parameters

theProductId string

DB field name is ProductItemProductID.

itemProductId string

DB field name is ProductItemBomProductID.

itemVariantId string

DB field name is ProductItemBomVariantID.

Returns

bool

true if product exist.

ClearCache()

public static void ClearCache()

Clone()

Clones this instance.

public ProductItem Clone()

Returns

ProductItem

ProductItem object.

Copy()

Copies this instance. ID is empty.

public ProductItem Copy()

Returns

ProductItem

ProductItem object.

Delete()

Deletes this product from DB.

public void Delete()

Delete(string)

Deletes the specified product item.

public void Delete(string itemId)

Parameters

itemId string

DB field name is ProductItemID.

Delete(string, string)

Deletes the specified product item.

public void Delete(string itemId, string theProductId)

Parameters

itemId string

DB field name is ProductItemID

theProductId string

DB field name is ProductItemProductID

DeleteItemsByGroups(IEnumerable<Group>)

public static void DeleteItemsByGroups(IEnumerable<Group> groups)

Parameters

groups IEnumerable<Group>

DeleteItemsByProducts(IEnumerable<Product>)

public static void DeleteItemsByProducts(IEnumerable<Product> products)

Parameters

products IEnumerable<Product>

GetById(string)

public static ProductItem GetById(string id)

Parameters

id string

Returns

ProductItem

GetProductItems()

public static IEnumerable<ProductItem> GetProductItems()

Returns

IEnumerable<ProductItem>

GetProductItems(Product)

Gets the product items.

public static ProductItemCollection GetProductItems(Product product)

Parameters

product Product

The product.

Returns

ProductItemCollection

LoadProductItems(ProductCollection)

Loads the product items.

public static void LoadProductItems(ProductCollection products)

Parameters

products ProductCollection

The products.

LoadProductItems(IEnumerable<Product>)

Loads the product items.

public static void LoadProductItems(IEnumerable<Product> products)

Parameters

products IEnumerable<Product>

The products.

Save()

Saves the current product item.

public void Save()

Save(string, string, string, string)

Saves the properties into DB.

public void Save(string theProductId, string itemId, string theBomProductId, string theBomGroupId)

Parameters

theProductId string

DB field name is ProductItemProductID

itemId string

DB field name is ProductItemID

theBomProductId string

DB field name is ProductItemBomProductID

theBomGroupId string

DB field name is ProductItemBomGroupID

Save(string, string, string, string, string)

Saves the properties into DB.

public void Save(string theProductId, string itemId, string theBomProductId, string bomVarId, string theBomGroupId)

Parameters

theProductId string

DB field name is ProductItemProductID

itemId string

DB field name is ProductItemID

theBomProductId string

DB field name is ProductItemBomProductID

bomVarId string

DB field name is ProductItemBomProductID

theBomGroupId string

DB field name is ProductItemBomGroupID

To top