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
dataReaderIDataReader- DataReader.
ProductItem(string)
Initializes a new instance of the ProductItem class.
[Obsolete("Use ProductItem.GetById instead")]
public ProductItem(string id)
Parameters
idstring- The item ID. DB field name is ProductItemID.
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
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
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
theProductIdstring- DB field name is ProductItemProductID.
itemGroupIdstring- DB 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
theProductIdstring- DB field name is ProductItemProductID.
itemProductIdstring- DB 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
theProductIdstring- DB field name is ProductItemProductID.
itemProductIdstring- DB field name is ProductItemBomProductID.
itemVariantIdstring- DB 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(GroupCollection)
[Obsolete("Use ProductItem.DeleteItemsByGroups instead.")]
public string Delete(GroupCollection groups)
Parameters
groupsGroupCollection
Returns
Delete(GroupCollection, bool)
[Obsolete("Use ProductItem.DeleteItemsByGroups instead.")]
public string Delete(GroupCollection groups, bool run)
Parameters
groupsGroupCollectionrunbool
Returns
Delete(ProductCollection)
[Obsolete("Use ProductItem.DeleteItemsByProducts instead.")]
public string Delete(ProductCollection productCollection)
Parameters
productCollectionProductCollection
Returns
Delete(ProductCollection, bool)
[Obsolete("Use ProductItem.DeleteItemsByProducts instead.")]
public string Delete(ProductCollection productCollection, bool run)
Parameters
productCollectionProductCollectionrunbool
Returns
Delete(IEnumerable<Group>)
Deletes the specified groups.
[Obsolete("Use ProductItem.DeleteItemsByGroups instead.")]
public CommandBuilder Delete(IEnumerable<Group> groups)
Parameters
groupsIEnumerable<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
groupsIEnumerable<Group>- The groups.
runbool- if set to
trueto 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
productCollectionIEnumerable<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
productsIEnumerable<Product>- The products.
runbool- if set to
trueto delete.
Returns
- CommandBuilder
- The SQL query.
Delete(string)
Deletes the specified product item.
public void Delete(string itemId)
Parameters
itemIdstring- DB field name is ProductItemID.
Delete(string, string)
Deletes the specified product item.
public void Delete(string itemId, string theProductId)
Parameters
itemIdstring- DB field name is ProductItemID
theProductIdstring- DB 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(Product)
Gets the product items.
public static ProductItemCollection GetProductItems(Product product)
Parameters
productProduct- The product.
Returns
LoadProductItems(ProductCollection)
Loads the product items.
public static void LoadProductItems(ProductCollection products)
Parameters
productsProductCollection- The 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
theProductIdstring- DB field name is ProductItemProductID
itemIdstring- DB field name is ProductItemID
theBomProductIdstring- DB field name is ProductItemBomProductID
theBomGroupIdstring- 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)