Class PriceManager
- Namespace
- Dynamicweb.Ecommerce.Prices
- Assembly
- Dynamicweb.Ecommerce.dll
Represents a price manager. Provides prepares and finds prices.
public static class PriceManager
- Inheritance
-
PriceManager
- Inherited Members
Examples
using Dynamicweb.Ecommerce.Prices;
using Dynamicweb.Ecommerce.Products;
namespace Dynamicweb.Ecommerce.Examples.Prices;
class PriceManagerSample : PriceManager
{
public PriceInfo GetCustomerPrice(PriceContext context, Product product)
{
PriceInfo customerPrice = GetPrice(context, product);
//find your own price
if (context.Customer is not null && context.Customer.CustomerNumber.StartsWith("abc"))
customerPrice.Multiply(0.5);
return customerPrice;
}
}
Methods
FindPrice(PriceContext, PriceProductSelection, bool)
public static object FindPrice(PriceContext context, PriceProductSelection selection, bool isInformative)
Parameters
context
PriceContextselection
PriceProductSelectionisInformative
bool
Returns
FindPrice(PriceContext, Product, string, long, bool)
public static object FindPrice(PriceContext context, Product product, string unitId, long stockLocationId, bool isInformative)
Parameters
context
PriceContextproduct
ProductunitId
stringstockLocationId
longisInformative
bool
Returns
GetInformativePrice(PriceContext, Product)
Gets the informative price for a given product.
public static PriceInfo GetInformativePrice(PriceContext context, Product product)
Parameters
context
PriceContextPrice context
product
ProductProduct
Returns
- PriceInfo
Informative price
GetInformativePrice(PriceContext, Product, string, long)
Gets the informative price for a given product.
public static PriceInfo GetInformativePrice(PriceContext context, Product product, string unitId, long stockLocationId)
Parameters
context
PriceContextPrice context
product
ProductProduct
unitId
stringUnit identifier
stockLocationId
longStock location identifier
Returns
- PriceInfo
Informative price
GetPrice(PriceContext, Product)
Gets the price for a given product.
public static PriceInfo GetPrice(PriceContext context, Product product)
Parameters
context
PriceContextPrice context
product
ProductProduct
Returns
- PriceInfo
Price
GetPrice(PriceContext, Product, string, long)
Gets the price for a given product.
public static PriceInfo GetPrice(PriceContext context, Product product, string unitId, long stockLocationId)
Parameters
context
PriceContextPrice context
product
ProductProduct
unitId
stringUnit identifier
stockLocationId
longStock location identifier
Returns
- PriceInfo
Price
GetQuantityPrices(PriceContext, Product)
Gets all quantity prices for a given product.
public static IEnumerable<KeyValuePair<PriceQuantityInfo, PriceInfo>> GetQuantityPrices(PriceContext context, Product product)
Parameters
context
PriceContextPrice context
product
ProductProduct
Returns
- IEnumerable<KeyValuePair<PriceQuantityInfo, PriceInfo>>
All applicable quantity prices for a product in a given context.
PreparePrices(PriceContext, IEnumerable<PriceProductSelection>)
Prepares the prices.
public static void PreparePrices(PriceContext context, IEnumerable<PriceProductSelection> selections)
Parameters
context
PriceContextThe price context.
selections
IEnumerable<PriceProductSelection>The product selections.
PreparePrices(PriceContext, IEnumerable<Product>)
Prepares the prices.
public static void PreparePrices(PriceContext context, IEnumerable<Product> products)
Parameters
context
PriceContextThe price context.
products
IEnumerable<Product>The products.
PreparePrices(PriceContext, IEnumerable<Product>, long)
Prepares the prices.
public static void PreparePrices(PriceContext context, IEnumerable<Product> products, long stockLocationId)
Parameters
context
PriceContextThe price context.
products
IEnumerable<Product>The products.
stockLocationId
longStock location identifier