Hello,
I am attempting to write a script to update a shopping cart. I have the following code:
--------------------------------------------------------------------------------------------------
<cfloop from = "1" to ="#ArrayLen(session.MyCart)#" index="count">
<!--- set new quantity --->
<cfset session.MyCart.item = form.item>
<cfset session.MyCart.quantity = form.quantity>
<cfset session.MyCart.price = form.price>
<cfset session.MyCart.sub_total = form.price * form.quantity>
<cfset i = i + 1>
</cfloop>
--------------------------------------------------------------------------------------------------
The problem is that this will update fine if there is only one item in the cart. But when there is two, an error is caused.
Can someone tell me what is wrong with this or suggest a better way to do this?
Any help is greatly appreciated.
Thanks!
I am attempting to write a script to update a shopping cart. I have the following code:
--------------------------------------------------------------------------------------------------
<cfloop from = "1" to ="#ArrayLen(session.MyCart)#" index="count">
<!--- set new quantity --->
<cfset session.MyCart.item = form.item>
<cfset session.MyCart.quantity = form.quantity>
<cfset session.MyCart.price = form.price>
<cfset session.MyCart.sub_total = form.price * form.quantity>
<cfset i = i + 1>
</cfloop>
--------------------------------------------------------------------------------------------------
The problem is that this will update fine if there is only one item in the cart. But when there is two, an error is caused.
Can someone tell me what is wrong with this or suggest a better way to do this?
Any help is greatly appreciated.
Thanks!