October 20th, 2008, 08:11 PM
|
#21 (permalink)
| | Junior Member
Join Date: Oct 2008
Posts: 17
|
This is what I have: 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(CCart,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_Price,i)
end function
function CCcart_GrandTotal
CCcart_GrandTotal=CCcart_SubTotal + CCcart_Shipping + CCcart_SalesTax - CCcart_Discount
end function
function CartToCookie(thearray,cookiename)
mystring=""
for j=0 to ubound(thearray,2)
if thearray(CC_ProductID,j) <> "" then
for i=0 to 9
mystring=mystring & thearray(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()
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
%> This is the error now: Error Type: Type Mismatch
/store/inc_CharonCart.asp, line 23
Which is: for i=0 to ubound(CCcart,2) Edit: it also does it now whenever I view details.
Last edited by xingxang : October 20th, 2008 at 08:14 PM.
|
| |
October 21st, 2008, 01:09 PM
|
#22 (permalink)
| | Real gangstas sip on Yacc
Join Date: Oct 2001 Location: Suckas-ville
Posts: 4,549
|
Don't know man. I don't have Sun ASP to test anything on and that code is ugly as hell.
I personally would not use that code if you paid me. I imagine it isn't very secure.
Sorry I can't be of more help,
Jkrohn
__________________
Signatures blow hard
If your signature contains an ad of any kind, congratulations, you're on my ignore list.
|
| |
October 21st, 2008, 02:00 PM
|
#23 (permalink)
| | Junior Member
Join Date: Oct 2008
Posts: 17
| Quote:
Originally Posted by jkrohn Don't know man. I don't have Sun ASP to test anything on and that code is ugly as hell.
I personally would not use that code if you paid me. I imagine it isn't very secure.
Sorry I can't be of more help,
Jkrohn | HAhaha. Hey, I appreciate your bearing with my problem as long as you have. And I appreciate your honesty about the code. I'm at the point now where I want to ditch this cart and set up another one. The host (hostgator.com) has agora cart on their server already, you have any shopping cart recommendations? |
| |
October 21st, 2008, 04:11 PM
|
#24 (permalink)
| | Real gangstas sip on Yacc
Join Date: Oct 2001 Location: Suckas-ville
Posts: 4,549
|
No, I don't do any work in that sector. Someone else may though. Start a new thread so it gets some attention. |
| |
October 21st, 2008, 08:02 PM
|
#25 (permalink)
| | Ultimate Member
Join Date: Oct 2001 Location: Everywhere
Posts: 1,050
|
if you haven't completely dumped this cart, you may want to look at how you are dimensioning your variables.
I don't know ASP, but in VisualBasic, when you dimension (Dim) a variable without defining the type, it comes in as a Variant, meaning that it can be flexible but the language has to guess. I got type mismatch errors when i tried to Dim vars without giving them a type (particularly if I was working with integers or other number values). What solved it for me was being specific about my variables. That is: Code: Dim CCart() as Object
Dim MyArray() As Array
Dim i As Integer (Or whatever is appropriate)
as opposed to just Code: Dim CCart()
Dim MyArray()
Dim i This way, the language knows how to pass and handle these variables.
just a thought. |
| | |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | | |
Posting Rules
| You may post new threads You may post replies You may not post attachments You may not edit your posts HTML code is Off | | | | Most Active Discussions | | | | | Recent Discussions  | | | | | |