<% Sub CalculateHandling (subtotal, total, shippingcost, handling) '*************************************************************** ' This routine calculates handling fee for VP-ASP ' Inputs are ' subtotal - price of of products order ' total - price including shipping ' shippingcost cost of shipping ' handling this value needs to be set and returned ' Version 5.0 ' April 5, 2003 '***************************************************************** Handling=0 If getconfig("xhandlingPrice")<>"" then Handling=getconfig("xhandlingPrice") end if If getconfig("xhandlingbyproduct")<>"" then Calculatehandlingbyproduct handling end if end sub ' Sub Calculatehandlingbyproduct (handling) dim handlingfield handlingfield=getconfig("xhandlingbyproduct") Dim productname, quantity, price, handlingdbc dim scartitem, arrcart, productid, productcode, handlingforitem dim handlingamount Dim i dim productql dim rsitem ' ShopOpenDatabase handlingDbc scartItem = Session("CartCount") ' number of products arrCart = Session("CartArray") For i = 1 to scartItem productid=arrCart(cProductid,i) productcode=arrCart(cProductCode,i) productname= arrCart(cProductname,i) quantity=arrCart(cQuantity,i) Price=arrCart(cUnitPrice, i) productql="select * from products where catalogid=" & productid Set rsItem = handlingdbc.execute(Productql) handlingforitem=0 If Not rsItem.EOF Then if not isnull(rsitem(handlingfield)) then handlingamount=rsitem(handlingfield) handlingamount=csng(handlingamount) handlingforItem=Quantity*handlingamount end if end if handling=handling+handlingForItem closeRecordset rsitem Next ShopCloseDatabase handlingdbc end sub %>