Dynamicweb 8 Documentation
FeeProvider Class
Members  Example 

The FeeProvider allows you to manipulate the shipping fee of an order in eCommerce using class inherited from Dynamicweb.eCommerce.Orders.FeeProvider.
Syntax
'Declaration
 
Public Class FeeProvider 
public class FeeProvider 
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;
}
}
Inheritance Hierarchy

System.Object
   Dynamicweb.eCommerce.Orders.FeeProvider

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 Members
Dynamicweb.eCommerce.Orders Namespace

Send Feedback