Dynamicweb 8 Documentation
FindPrice(Product,Double,String,Currency) Method
Example 

The product.
The quantity.
The variant ID.
The currency.
Finds the price.
Syntax
'Declaration
 
Public Overloads Shared Function FindPrice( _ 
   ByVal Product As Product, _ 
   ByVal Quantity As Double, _ 
   ByVal VariantID As String, _ 
   ByVal Currency As Currency _ 
) As Object
public static object FindPrice( 
   Product Product,
   double Quantity,
   string VariantID,
   Currency Currency 
)

Parameters

Product
The product.
Quantity
The quantity.
VariantID
The variant ID.
Currency
The currency.
Example
class MyPage : System.Web.UI.Page
{
    private Dynamicweb.eCommerce.Products.Product product;

    private void Page_Load(System.Object sender, System.EventArgs e)
    {
        product = (Dynamicweb.eCommerce.Products.Product)Session["Ecom.Backend.Product"];
    }

    private Dynamicweb.eCommerce.Prices.PriceInfo GetPrice(OrderLine orderlLine)
    {
        Dynamicweb.eCommerce.Prices.PriceInfo info = new Dynamicweb.eCommerce.Prices.PriceInfo();
        info.Currency = Dynamicweb.eCommerce.Common.Context.Currency;

        if (orderlLine.BOMOrderLines.Count > 0)
        {
            if (product.PriceType == ProductPriceType.FixedPrice)
            {
                object priceObj = Dynamicweb.eCommerce.Prices.PriceManager.FindPrice(product, orderlLine.Quantity, orderlLine.ProductVariantID, Dynamicweb.eCommerce.Common.Context.Currency, orderlLine.UnitID);
                if (priceObj != null)
                {
                    if ((priceObj) is Dynamicweb.eCommerce.Prices.PriceInfo)
                    {
                        Dynamicweb.eCommerce.Prices.PriceInfo pi = (Dynamicweb.eCommerce.Prices.PriceInfo)priceObj;
                        info = info.Add(pi);
                    }
                    else if ((priceObj) is Dynamicweb.eCommerce.Prices.PriceRaw)
                    {
                        Dynamicweb.eCommerce.Prices.PriceRaw rp = (Dynamicweb.eCommerce.Prices.PriceRaw)priceObj;
                        Dynamicweb.eCommerce.Prices.PriceCalculated cp = new Dynamicweb.eCommerce.Prices.PriceCalculated(product, rp);
                        info = info.Add(cp);
                    }
                }
            }
            else
            {
                //Adding only the BOM Orderlines
                info = info.Add(orderlLine.BOMOrderLines);
            }

            if (product.PriceType == ProductPriceType.CalculatedWithBase)
            {
                object priceObj = Dynamicweb.eCommerce.Prices.PriceManager.FindPrice(product, orderlLine.Quantity, orderlLine.ProductVariantID, Dynamicweb.eCommerce.Common.Context.Currency);
                if (priceObj != null)
                {
                    if ((priceObj) is Dynamicweb.eCommerce.Prices.PriceInfo)
                    {
                        Dynamicweb.eCommerce.Prices.PriceInfo pi = (Dynamicweb.eCommerce.Prices.PriceInfo)priceObj;
                        info = info.Add(pi);
                    }
                    else if ((priceObj) is Dynamicweb.eCommerce.Prices.PriceRaw)
                    {
                        Dynamicweb.eCommerce.Prices.PriceRaw rp = (Dynamicweb.eCommerce.Prices.PriceRaw)priceObj;
                        Dynamicweb.eCommerce.Prices.PriceCalculated cp = new Dynamicweb.eCommerce.Prices.PriceCalculated(product, rp);
                        info = info.Add(cp);
                    }
                }
            }
        }
        else
        {
            object priceObj = Dynamicweb.eCommerce.Prices.PriceManager.FindPrice(product, orderlLine.Quantity, orderlLine.ProductVariantID, Dynamicweb.eCommerce.Common.Context.Currency, orderlLine.UnitID);
            if (priceObj != null)
            {
                if ((priceObj) is Dynamicweb.eCommerce.Prices.PriceInfo)
                {
                    Dynamicweb.eCommerce.Prices.PriceInfo pi = (Dynamicweb.eCommerce.Prices.PriceInfo)priceObj;
                    info = info.Add(pi);
                }
                else if ((priceObj) is Dynamicweb.eCommerce.Prices.PriceRaw)
                {
                    Dynamicweb.eCommerce.Prices.PriceRaw rp = (Dynamicweb.eCommerce.Prices.PriceRaw)priceObj;
                    Dynamicweb.eCommerce.Prices.PriceCalculated cp = new Dynamicweb.eCommerce.Prices.PriceCalculated(product, rp);
                    info = info.Add(cp);
                }
            }
        }
        return info;
    }
}
Requirements

Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

See Also

Reference

PriceManager Class
PriceManager Members
Overload List

Send Feedback