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
BomNoProductText
Gets or sets BOM product text.
public string BomNoProductText { get; set; }
Property Value
BomProductId
Gets or sets BOM product ID.
public string BomProductId { get; set; }
Property Value
BomUnitId
Gets or sets BOM unit ID.
public string BomUnitId { get; set; }
Property Value
BomVariantId
Gets or sets BOM variant ID.
public string BomVariantId { get; set; }
Property Value
DefaultProductId
Gets or sets default product ID.
public string DefaultProductId { get; set; }
Property Value
DefaultUnitId
Gets or sets default unit ID.
public string DefaultUnitId { get; set; }
Property Value
DefaultVariantId
Gets or sets default product variant ID.
public string DefaultVariantId { get; set; }
Property Value
Id
Gets or sets the item ID.
public string Id { get; set; }
Property Value
Name
Gets or sets the item name.
public string Name { get; set; }
Property Value
ProductId
Gets or sets the product ID.
public string ProductId { get; set; }
Property Value
Products
Gets or sets a collection of products.
public ProductCollection Products { get; set; }
Property Value
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
stringDB field name is ProductItemProductID.
itemGroupId
stringDB 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
stringDB field name is ProductItemProductID.
itemProductId
stringDB 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
stringDB field name is ProductItemProductID.
itemProductId
stringDB field name is ProductItemBomProductID.
itemVariantId
stringDB 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
stringDB field name is ProductItemID.
Delete(string, string)
Deletes the specified product item.
public void Delete(string itemId, string theProductId)
Parameters
itemId
stringDB field name is ProductItemID
theProductId
stringDB 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
GetProductItems()
public static IEnumerable<ProductItem> GetProductItems()
Returns
GetProductItems(Product)
Gets the product items.
public static ProductItemCollection GetProductItems(Product product)
Parameters
product
ProductThe product.
Returns
LoadProductItems(ProductCollection)
Loads the product items.
public static void LoadProductItems(ProductCollection products)
Parameters
products
ProductCollectionThe 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
stringDB field name is ProductItemProductID
itemId
stringDB field name is ProductItemID
theBomProductId
stringDB field name is ProductItemBomProductID
theBomGroupId
stringDB 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)