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;
public class BomConfiguratorSample
{
private Template _template = new Template();
private ProductCollection _bomProducts = new ProductCollection();
private ProductItemCollection _configurators = new ProductItemCollection();
private Product _product = new 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 (string.IsNullOrEmpty(item.BomGroupId))
_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
trueif 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
theProductIdstringDB field name is ProductItemProductID.
itemGroupIdstringDB field name is ProductItemBomGroupID.
Returns
- bool
trueif group exist.
CheckProduct(string, string)
Checks the product item is exist.
public bool CheckProduct(string theProductId, string itemProductId)
Parameters
theProductIdstringDB field name is ProductItemProductID.
itemProductIdstringDB field name is ProductItemBomProductID.
Returns
- bool
trueif product exist.
CheckProduct(string, string, string)
Checks the product item is exist.
public bool CheckProduct(string theProductId, string itemProductId, string itemVariantId)
Parameters
theProductIdstringDB field name is ProductItemProductID.
itemProductIdstringDB field name is ProductItemBomProductID.
itemVariantIdstringDB field name is ProductItemBomVariantID.
Returns
- bool
trueif 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
itemIdstringDB field name is ProductItemID.
Delete(string, string)
Deletes the specified product item.
public void Delete(string itemId, string theProductId)
Parameters
itemIdstringDB field name is ProductItemID
theProductIdstringDB field name is ProductItemProductID
DeleteItemsByGroups(IEnumerable<Group>)
public static void DeleteItemsByGroups(IEnumerable<Group> groups)
Parameters
groupsIEnumerable<Group>
DeleteItemsByProducts(IEnumerable<Product>)
public static void DeleteItemsByProducts(IEnumerable<Product> products)
Parameters
productsIEnumerable<Product>
GetById(string)
public static ProductItem GetById(string id)
Parameters
idstring
Returns
GetProductItems()
public static IEnumerable<ProductItem> GetProductItems()
Returns
GetProductItems(Product)
Gets the product items.
public static ProductItemCollection GetProductItems(Product product)
Parameters
productProductThe product.
Returns
LoadProductItems(ProductCollection)
Loads the product items.
public static void LoadProductItems(ProductCollection products)
Parameters
productsProductCollectionThe products.
LoadProductItems(IEnumerable<Product>)
Loads the product items.
public static void LoadProductItems(IEnumerable<Product> products)
Parameters
productsIEnumerable<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
theProductIdstringDB field name is ProductItemProductID
itemIdstringDB field name is ProductItemID
theBomProductIdstringDB field name is ProductItemBomProductID
theBomGroupIdstringDB 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)