PDA

View Full Version : Chili!Soft and Charon Cart


xingxang
10-19-2008, 05:33 AM
I just migrated a website from a Windows server to a Linux server. The server is running Chilisoft for ASP compatibility. I'm having a hell of a time trying to find the source of a runtime error I'm getting: "Error Type: Sun ONE ASP VBScript runtime (0x800A000D); Type mismatch; /store/inc_CharonCart.asp, line 67." My question is: Is it possible to run CharonCart on a ChiliSoft ASP server? And if so, what's needed?
Here's the code:
<%
CONST CC_ProductID = 0
CONST CC_Quantity = 1
CONST CC_Name = 2
CONST CC_Price = 3
CONST CC_UniqueKey = 4
CONST CC_Weight = 5
CONST CC_Color = 6
CONST CC_Size = 7
CONST CC_Skew = 8
if Request.Cookies("CharonCart") = "" then
dim CCcart(9,50)
else
CCcart=CookieToCart("CharonCart")
end if

CCcart_SubTotal=0
CCcart_numItems=0
CCcart_Shipping=0
CCcart_Discount=0
CCcart_SalesTax=0
isFound=false
for i=0 to ubound(CCcart,2)
if CCcart(CC_ProductID,i) <> "" then
isFound=true
CCcart_SubTotal=CCcart_SubTotal + (CCcart(CC_Quantity,i)*CCcart(CC_Price,i))
CCcart_numItems=CCcart_numItems + 1
end if
next
function CCcart_LineTotal
CCcart_LineTotal=CCcart(CC_Quantity,i)*CCcart(CC_P rice,i)
end function
function CCcart_GrandTotal
CCcart_GrandTotal=CCcart_SubTotal + CCcart_Shipping + CCcart_SalesTax - CCcart_Discount
end function

function CartToCookie(thearray,cookiename)
on error resume next
mystring=""
for j=0 to ubound(CCcart,2)
if CCcart(CC_ProductID,j) <> "" then
for i=0 to 9
mystring=mystring & CCcart(i,j) & "^"
next
mystring=left(mystring,len(mystring)-1)
mystring=mystring & "|"
end if
next
mystring=left(mystring,len(mystring)-1)
Response.Cookies(cookiename)=mystring
end function

function CookieToCart(cookiename)
dim myarray(9,50)
mystring=Request.Cookies(cookiename)
productarray=split(mystring,"|")
for j=0 to ubound(productarray)
itemarray=split(productarray(j),"^")
for i=0 to 9
if itemarray(i) <> "" then
myarray(i,j)=itemarray(i)
else
myarray(i,j)=null
end if
next
next
CookieToCart=myarray
end function

%>

Update: I have found that if I close out the browser and delete temporary internet files and cookies and reopen it, everything works fine and I can access the cart only ONCE. After that, I cannot view the cart, add to cart, or even view the details of the item.

$20 bucks to the first one to help me get to the bottom of this...

ranjan
10-31-2008, 09:28 AM
Try defining the type to your variables like:

Dim CCart() as Object
Dim MyArray() As Array
Dim i As Integer

as opposed to just:

Dim CCart()
Dim MyArray()
Dim i