Class DefaultPriceProvider
- Namespace
- Dynamicweb.Ecommerce.Prices
- Assembly
- Dynamicweb.Ecommerce.dll
Represents a default price provider.
public class DefaultPriceProvider : PriceProvider
- Inheritance
-
DefaultPriceProvider
- Inherited Members
Constructors
DefaultPriceProvider()
public DefaultPriceProvider()
Methods
FindInformativePrice(PriceContext, PriceProductSelection)
Finds the informative price. Must be overridden.
public override PriceRaw? FindInformativePrice(PriceContext context, PriceProductSelection selection)
Parameters
contextPriceContextContext information.
selectionPriceProductSelectionProduct information.
Returns
FindPrice(PriceContext, PriceProductSelection)
Finds the price for a given product in a given context. Can be called to show the price of a product, show the price of a product for a specific user, unit etc. Must be overriden.
public override PriceRaw FindPrice(PriceContext context, PriceProductSelection selection)
Parameters
contextPriceContextContext information.
selectionPriceProductSelectionProduct information.
Returns
Remarks
This method is called in 2 contexts. For showing a product and a product added to a cart or order. If the call comes from an order object, it can have a quantity of 2 or more and can be used to return the unit price for a product that is cheaper if more than one is bought
FindQuantityPrices(PriceContext, Product)
Finds the quantity prices for a product in a given context.
public override IEnumerable<KeyValuePair<PriceQuantityInfo, PriceRaw>> FindQuantityPrices(PriceContext context, Product product)
Parameters
contextPriceContextContext information.
productProductProduct to find prices for.
Returns
- IEnumerable<KeyValuePair<PriceQuantityInfo, PriceRaw>>
All applicable quantity prices for the product.
PreparePrices(PriceContext, IEnumerable<PriceProductSelection>)
Prepares prices for a collection of products. Must be overridden.
public override void PreparePrices(PriceContext context, IEnumerable<PriceProductSelection> selections)
Parameters
contextPriceContextContext information.
selectionsIEnumerable<PriceProductSelection>Product selections with a list of products and their quantity in the current cart or order.
Remarks
This method is called before the actual use of each product price. Use this method to find all the prices needed in the upcoming FindPrice calls. This method can be used to retrieve i.e. 30 prices from an ERP system and saved into a cache that is later used by FindPrice.