<% ' Subroutines that may be useful '****************************************************************** ' addtocart is a low level routine to an an item to the cart ' VP-ASP 5.00 Feb 19, 2003 ' ***************************************************************** Sub AddToCart (Catalogid, code, quantity, nameincart, price, category, weight) dim scartitem, arrCart dim rc rc=0 'debugwrite " adding " & nameincart LocateInArray catalogid,nameincart,rc ' see if we already have some if rc=0 then ' already found exit sub end if arrCart = GetSessA("CartArray") scartItem = GetSess("CartCount") If scartItem = getconfig("xMaxCartitems") and scartItem>0 then shoperror getlang("Langerror02") End If scartitem=scartitem+1 SetSess "CartCount",scartitem arrCart(cProductid,scartItem) = catalogid arrCart(cProductCode,scartItem) = code arrCart(cProductname,scartItem) = NameInCart arrCart(cQuantity,scartItem) = Clng(quantity) arrCart(cOriginalPrice,scartItem) = Price arrCart(cUnitPrice,scartItem) = Price if XdualPrice="Yes" then Convertcurrency Price, strDualPrice arrCart(cDualPrice,scartItem) = strDualprice else arrCart(cDualPrice,scartItem) = 0 end if arrCart(cCategory,scartItem) = category arrCart(cDelivery,scartItem) = "" arrCart(cMinimumQuantity,scartItem) = "" arrCart(cmaximumQuantity,scartItem) = "" arrCart(cSupplierid,scartItem) = 0 arrCart(cStockLevel,scartItem) = "" arrCart(cProductimage,scartItem) = "" arrCart(cProductweight,scartItem) = weight arrCart(cProductassociated,scartItem) = "" arrCart(cGroupDiscount,scartItem) = "" arrCart(cProductFeatures,scartItem) = "" SetSessA "CartArray",arrCart end sub ' ' If we find it then just add new quantity Sub LocateInArray(id,nameincart,rc) Dim i dim lngid dim scartitem dim arrcart lngid=clng(id) rc=4 ' not found scartItem = GetSess("CartCount") If scartitem=0 then exit sub end if arrCart = GetSessA("CartArray") For i = 1 to scartItem If lngid = arrCart(cProductid,i) and nameincart=arrcart(cProductname,i) then arrCart(cQuantity,i) = arrCart(cQuantity,i)+ CInt(quantity) rc=0 SetSessA "CartArray",arrCart exit sub end if Next End Sub %>