You don't notice the one big difference between before and after?
The old code updated a cart items quantity based on the corresponding form
fields value.
There are a few ways to do it... one way would be to give each cart item its
OWN form. Use the +/- as the submit buttons. Hide the cart item id in a
hidden field for each form so you know which item to adjust then just +1 or
-1 based on which submit button was clicked.
<cfloop from="1" to="#ArrayLen(SESSION.cart)#" index="i">
<form action="#cgi.script_name#?#cgi.query_string#" method="post">
<input type="hidden" name="cartItemID" value="#i#" />
<input type="submit" name="increaseQTY" value="+" />
<input type="submit" name="dereaseQTY" value="-" />
#SESSION.cart[i].ItemName#
</form>
<br />
</cfloop>
<cfif isdefined('form.increaseQTY')>
<cfset val(SESSION.cart[FORM["cartItemID"]].quantite) =
val(SESSION.cart[FORM["cartItemID"]].quantite) + 1 />
<cfelseif isdefined('form.decreaseQTY')>
<cfset val(SESSION.cart[FORM["cartItemID"]].quantite) =
val(SESSION.cart[FORM["cartItemID"]].quantite) - 1 />
</cfif>
form.increaseQTY.y and form.decreaseQTY.y if you use images for the plus and
minus
-----Original Message-----
From: marc collignon [mailto:[EMAIL PROTECTED]
Sent: Friday, April 04, 2008 12:26 PM
To: CF-Talk
Subject: Re: some issue while increment/decrement value of product in a
shopping cart
Hi Bob,
Thank you for your prompt answer ,
In deed I do loop in to all the Session content, but how can I provent that
before I did add that increase / decrease feature , customers add to manualy
change the quantity field value to upgrade it and it was working and not
affecting the all session content
the code was
<cfelseif Isdefined ('FORM.update_button.y')>
<cfloop from="1" to="#ArrayLen(SESSION.cart)#" index="i">
<cfset SESSION.cart[i].quantite = FORM["quantite_" & i] />
</cfloop>
<cflocation url="contenu_commande.cfm">
the only thing I did is to duplicate the fucntion and add the increase /
decrease build in function to it.
thank you for your help
Marc
>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to
date
Get the Free Trial
http://ad.doubleclick.net/clk;192386516;25150098;k
Archive:
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:302749
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4