Dynamicweb 8 Documentation
FindFee Method
Example 

The order.
Finds the fee for the order that should replace standard ones.
Syntax
'Declaration
 
Public Overridable Function FindFee( _ 
   ByVal Order As Order _ 
) As PriceRaw
public virtual PriceRaw FindFee( 
   Order Order 
)

Parameters

Order
The order.

Return Value

Returns shipping fee for the specified order
Example
The following example demonstrates how to grant free shipping to customers who posts multiple orders within 24 hours. If the web shop can ship the items from the first and second order together, there is no need for the customer to be double-charged for shipping and handling. In cases where no previous orders have been submitted, the FeeProvider simply returns null which then will cause Dynamicweb eCommerce to ignore the FeeProvider when it sorts out the shipping fee.
public class MyFeeProvider:Dynamicweb.eCommerce.Orders.FeeProvider
{
    public override Dynamicweb.eCommerce.Prices.PriceRaw
    FindFee(Dynamicweb.eCommerce.Orders.Order Order)
    {
        Dynamicweb.eCommerce.Prices.PriceRaw ReturnFee = null;
        if (Order.CustomerEmail != "")
        {
            IDataReader DR = Database.CreateDataReader(
                string.Format("SELECT TOP 1 * FROM EcomOrders WHERE
                              OrderCustomerEmail = '{0}' AND
                              OrderDate >= DATEADD(day, -1, GETDATE()) AND
                              OrderComplete = {1}", Order.CustomerEmail, Database.SqlBool(true)), "Ecom.mdb");
            if (DR.Read())
            {
                ReturnFee = new Dynamicweb.eCommerce.Prices.PriceRaw(0.00, Dynamicweb.eCommerce.Common.Application.DefaultCurrency);
            }
        }
    return ReturnFee;
}
}
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

FeeProvider Class
FeeProvider Members

Send Feedback