I have a shopping cart. When the customer proceeds to checkout, they go to a new domain. Session variables cannot be passed, so I must re-build my cart on the new domain. Trouble is, the structure is re-built in a different order and I can't figure out why. There is no pattern, it is not always reversed, for example.
Before checkout, I have a form with hidden fields which are built dynamically. Might look like:
<form action="newpath/newpage.cfm" method="POST">
<input type="hidden" name="CartList1" value="54,Book titleA,25.0,20.0,1">
<input type="hidden" name="CartList2" value="234,Book titleB,30.0,10.0,1">
<input type="hidden" name="CartList3" value="21,Book titleC,10.0,5.0,1">
<input type="hidden" name="lastrownum" value="3">
</form>
On next page, (in new domain), I re-build the cart:
<cfset session.newcart = structnew()>
<cfloop index="x" from="1" to="#form.lastrownum#">
<cfset z=Evaluate("CartList"&"#x#"
>
<cfset tempvalue = listtoarray(z ,","
>
<cfset StructInsert(session.newcart,z,tempvalue)>
</cfloop>
It would seem that it would keep the same order, but it does not! Any help is appreciated!
Before checkout, I have a form with hidden fields which are built dynamically. Might look like:
<form action="newpath/newpage.cfm" method="POST">
<input type="hidden" name="CartList1" value="54,Book titleA,25.0,20.0,1">
<input type="hidden" name="CartList2" value="234,Book titleB,30.0,10.0,1">
<input type="hidden" name="CartList3" value="21,Book titleC,10.0,5.0,1">
<input type="hidden" name="lastrownum" value="3">
</form>
On next page, (in new domain), I re-build the cart:
<cfset session.newcart = structnew()>
<cfloop index="x" from="1" to="#form.lastrownum#">
<cfset z=Evaluate("CartList"&"#x#"
<cfset tempvalue = listtoarray(z ,","
<cfset StructInsert(session.newcart,z,tempvalue)>
</cfloop>
It would seem that it would keep the same order, but it does not! Any help is appreciated!