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()

ProductItem(IDataReader)

Initializes a new instance of the ProductItem class.
[Obsolete("Use ProductItem.GetById instead")]
public ProductItem(IDataReader dataReader)

Parameters

dataReader IDataReader
DataReader.

ProductItem(string)

Initializes a new instance of the ProductItem class.
[Obsolete("Use ProductItem.GetById instead")]
public ProductItem(string id)

Parameters

id string
The item ID. DB field name is ProductItemID.

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

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

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(GroupCollection)

[Obsolete("Use ProductItem.DeleteItemsByGroups instead.")]
public string Delete(GroupCollection groups)

Parameters

groups GroupCollection

Returns

string

Delete(GroupCollection, bool)

[Obsolete("Use ProductItem.DeleteItemsByGroups instead.")]
public string Delete(GroupCollection groups, bool run)

Parameters

groups GroupCollection
run bool

Returns

string

Delete(ProductCollection)

[Obsolete("Use ProductItem.DeleteItemsByProducts instead.")]
public string Delete(ProductCollection productCollection)

Parameters

productCollection ProductCollection

Returns

string

Delete(ProductCollection, bool)

[Obsolete("Use ProductItem.DeleteItemsByProducts instead.")]
public string Delete(ProductCollection productCollection, bool run)

Parameters

productCollection ProductCollection
run bool

Returns

string

Delete(IEnumerable<Group>)

Deletes the specified groups.
[Obsolete("Use ProductItem.DeleteItemsByGroups instead.")]
public CommandBuilder Delete(IEnumerable<Group> groups)

Parameters

groups IEnumerable<Group>
The groups.

Returns

CommandBuilder
The SQL query.

Delete(IEnumerable<Group>, bool)

Deletes the specified groups.
[Obsolete("Use ProductItem.DeleteItemsByGroups instead.")]
public CommandBuilder Delete(IEnumerable<Group> groups, bool run)

Parameters

groups IEnumerable<Group>
The groups.
run bool
if set to true to delete.

Returns

CommandBuilder
The SQL query.

Delete(IEnumerable<Product>)

Deletes the specified products.
[Obsolete("Use ProductItem.DeleteItemsByProducts instead.")]
public CommandBuilder Delete(IEnumerable<Product> productCollection)

Parameters

productCollection IEnumerable<Product>
The products.

Returns

CommandBuilder
SQL query

Delete(IEnumerable<Product>, bool)

Deletes the specified products.
[Obsolete("Use ProductItem.DeleteItemsByProducts instead.")]
public CommandBuilder Delete(IEnumerable<Product> products, bool run)

Parameters

products IEnumerable<Product>
The products.
run bool
if set to true to delete.

Returns

CommandBuilder
The SQL query.

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(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