<cflock timeout="2" throwontimeout="yes" type="exclusive" scope="session">
        <cfloop from="1" to="#ArrayLen(Session.usersCart)#" index="idx">
                <cfif Request.factory.IsInteger(FORM['NumberOfCartTickets'&idx])>
                        <cfif FORM['NumberOfCartTickets'&idx]>
                                <cfset ArrayDeleteAt(Session.usersCart, idx)>
                        <cfelse>
                                <cfset 
Session.usersCart[idx][1]=FORM['NumberOfCartTickets'&idx]>
                        </cfif>
                </cfif>
        </cfloop>
</cflock>

Ok all, here is a block of code that recaculates totals in my cart.

Everything works great, except for when I enter 0 in the number of cart
tickets field, I want it to remove that item from the array. Now this is all
cool, except for when you use ArrayDeleteAt() it resizes the array. Normal
practice would be to use <cfbreak> after the delete, however I can't do that
because say you have 3 items in your cart like below:

numberoftickets
1
5
9

and you change the numbers like

numberoftickets
1
0
8

the 3rd item would not get updated because of the <cfbreak>

Anyone got any ideas.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Archives: http://www.houseoffusion.com/lists.cfm?link=t:4
Subscription: http://www.houseoffusion.com/lists.cfm?link=s:4
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4

Your ad could be here. Monies from ads go to support these lists and provide more 
resources for the community. 
http://www.fusionauthority.com/ads.cfm

Reply via email to