Class Product
- Namespace
- Dynamicweb.Ecommerce.Products
- Assembly
- Dynamicweb.Ecommerce.dll
Represents information about a product.
[Serializable]
public class Product
- Inheritance
-
Product
- Inherited Members
- Extension Methods
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
Product()
Initializes a new instance of the Product class.
public Product()
Properties
Active
Gets or sets the value that indicates if the product is active or not.
public bool Active { get; set; }
Property Value
ApprovalState
Gets or sets the state of the approval.
public ProductApprovalStateType ApprovalState { get; set; }
Property Value
- ProductApprovalStateType
The state of the approval.
AutoId
Gets or sets the automatic identifier assigned by the database.
public long AutoId { get; set; }
Property Value
- long
The auto id from the database. This ID should not be used as key or reference but only in runtime scenarios like querying or getting records from the API.
CommentCount
Gets or sets the count of comments.
public int CommentCount { get; set; }
Property Value
- int
The count of comments.
Cost
Gets or sets the default cost.
public double Cost { get; set; }
Property Value
- double
The default cost.
Created
Gets or sets the date when the product was created.
public DateTime Created { get; set; }
Property Value
DefaultPoints
Gets or sets product default price in loyalty points if the product is bought with loyalty points
public double DefaultPoints { get; set; }
Property Value
DefaultPrice
Gets or sets the default price. This price is a basis for calculating the final price that is displayed in the frontend.
public double DefaultPrice { get; set; }
Property Value
- double
The default price.
DefaultShopId
Gets or sets the default shop ID.
public string DefaultShopId { get; set; }
Property Value
- string
The default shop ID.
DefaultUnitId
Gets or sets the default ID of the unit.
public string DefaultUnitId { get; set; }
Property Value
DefaultVariantComboId
Gets or sets the default VariantComboID.
public string DefaultVariantComboId { get; set; }
Property Value
Depth
Gets or sets product depth
public double Depth { get; set; }
Property Value
Remarks
Related field ProductDepth
Discontinued
Gets or sets value indicating that product is discontinued
public bool Discontinued { get; set; }
Property Value
DiscontinuedAction
Gets or sets discontinued action
public DiscontinuedAction DiscontinuedAction { get; set; }
Property Value
EAN
Gets or sets Product EAN
public string EAN { get; set; }
Property Value
Remarks
Related field ProductEAN
ExcludeFromIndex
Gets or sets value indicating whether to exclude the product from indexing.
public bool ExcludeFromIndex { get; set; }
Property Value
ExpectedDelivery
Gets or sets the expected delivery date.
public DateTime ExpectedDelivery { get; set; }
Property Value
Groups
Gets or sets the collection of groups that own the product.
public GroupCollection Groups { get; }
Property Value
Height
Gets or sets product height
public double Height { get; set; }
Property Value
Remarks
Related field ProductHeight
Id
Gets or sets the ID of the product.
public string Id { get; set; }
Property Value
ImageLarge
Gets or sets a large image.
public string ImageLarge { get; set; }
Property Value
ImageMedium
Gets or sets a medium image.
public string ImageMedium { get; set; }
Property Value
ImageSmall
Gets or sets a small image.
public string ImageSmall { get; set; }
Property Value
Items
Gets or sets the collection of product items for composite BOM products.
public ProductItemCollection Items { get; }
Property Value
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);
}
}
}
}
}
}
LanguageId
Gets or sets the product language ID.
public string LanguageId { get; set; }
Property Value
LongDescription
Gets or sets the detailed description of the product.
public string LongDescription { get; set; }
Property Value
ManufacturerId
Gets or sets the ID of the product manufacturer.
public string ManufacturerId { get; set; }
Property Value
Meta
Gets or sets meta data. Meta information is used by search engines to index searches by means of keywords.
public ProductMetaData Meta { get; set; }
Property Value
Name
Gets or sets product name. Product name is used in the frontend product catalog.
public string Name { get; set; }
Property Value
NeverOutOfStock
Gets or sets value indicating whether to product can be never out of stock
public bool NeverOutOfStock { get; set; }
Property Value
Remarks
Related field ProductNeverOutOfStock
Number
Gets or sets the product number.
public string Number { get; set; }
Property Value
- string
number.
OrderLineFields
Gets the order line fields.
public OrderLineFieldCollection OrderLineFields { get; }
Property Value
- OrderLineFieldCollection
The order line fields.
PriceType
Gets or sets the type of the price e.group. calculated, fixed, fixed plus changes. Price type is only available if the product type is Parts List.
public ProductPriceType PriceType { get; set; }
Property Value
ProductFieldValues
Gets or sets the collection of custom product field values. Administrator can create custom product fields in the Management Center -> eCommerce settings -> Product catalog -> Product fields.
public ProductFieldValueCollection ProductFieldValues { get; set; }
Property Value
Examples
using Dynamicweb.Ecommerce.Products;
namespace Dynamicweb.Ecommerce.Examples
{
public class ProductProductFieldValuesSample
{
public void CreateNewProductWithProductFieldValue(string productFieldSystemName, object value)
{
// Create a new Product instance
var product = new Product();
// Set Product Name property
product.Name = "My new product";
// Get the ProductFieldValue object for the ProductField with the given system name
var productFieldValue = product.ProductFieldValues.GetProductFieldValue(productFieldSystemName);
// If the ProductFieldValue object exists then set its Value to the given value
if (productFieldValue != null)
productFieldValue.Value = value;
// Save the product to persist data
Services.Products.Save(product);
}
}
}
PurchaseMinimumQuantity
Gets or sets product purchase minimum quantity
public double PurchaseMinimumQuantity { get; set; }
Property Value
Remarks
Related field ProductPurchaseMinimumQuantity
PurchaseQuantityStep
Gets or sets product purchase qantity step
public double PurchaseQuantityStep { get; set; }
Property Value
Remarks
Related field ProductPurchaseQuantityStep
Rating
Gets or sets the rating of the product.
public double Rating { get; set; }
Property Value
- double
The rating.
ReplacementProductId
Gets or sets discontinued replacement product id
public string ReplacementProductId { get; set; }
Property Value
ReplacementVariantId
Gets or sets discontinued replacement product variant id
public string ReplacementVariantId { get; set; }
Property Value
ShortDescription
Gets or sets the short(teaser) description of the product.
public string ShortDescription { get; set; }
Property Value
ShowInProductList
Gets or sets value indicating whether to exclude the product from all products list
public bool ShowInProductList { get; set; }
Property Value
Stock
Gets or sets the product stock from the data record of the product (EcomProducts table).
public double Stock { get; set; }
Property Value
Remarks
Does not use the stock providers or get the stock levels from ERP in integrated solutions. Use StockLevelManager for getting the calculated value from the provider.
StockGroupId
Gets or sets StockGroupID.
public string StockGroupId { get; set; }
Property Value
TaxCollection
Gets the tax collection.
public TaxCollection TaxCollection { get; }
Property Value
Type
Gets or sets the type of the product (stock item, service, giftCard or parts list).
public ProductType Type { get; set; }
Property Value
UnitCount
Gets or sets the unit counting.
public int UnitCount { get; set; }
Property Value
Updated
Gets or sets the date when the product was updated.
public DateTime Updated { get; set; }
Property Value
VariantId
Gets or sets VariantID.
public string VariantId { get; set; }
Property Value
VirtualVariantId
Gets or sets VirtualVariantID.
public string VirtualVariantId { get; set; }
Property Value
Volume
Gets or sets the product volume.
public double Volume { get; set; }
Property Value
Weight
Gets or sets the product weight.
public double Weight { get; set; }
Property Value
Width
Gets or sets product width
public double Width { get; set; }
Property Value
Remarks
Related field ProductWidth
WorkflowStateId
Gets or sets the workflow state.
public int WorkflowStateId { get; set; }
Property Value
- int
The workflow state.