Hello,
I'm building a shopping cart and I've hit a bit of a snag. I'm using ±
buttons on a form to increase/decrease the qty of the item(s) in the
cart before purchase. Now I know how to access the new quantity of
items, but I don't know how to display them properly on the screen. If
i pass the number in the form post it actually shows the previous qty
on the url, not the current one (i.e. if you change from 1 item to 3
when you click recalculate it displays 1 until you reload the page
again). Also, I can put the new qty in a cfoutput and output it there
but I cant replace the forms text box. The code I'm using is below.
Any help would be appreciated. I'm sorry if I didn't explain it well
enough.
......
<cfset TheNewQuan="#session.cart[theid].quantity#" />
<cfif IsDefined("url.action") AND url.action IS "recalc">
<cfset thisThing=session.cart[theid].quantity>
<cfset thisOtherThing=form.current_qty>
<cfoutput>#thisOtherThing#</cfoutput>
<cfoutput>#thisThing#</cfoutput>
<cfoutput><cfset thisThing EQ thisOtherThing>
#thisThing#
</cfoutput>
</cfif>
<form name="qty_adjust#theid#"
action="#cgi.script_name#?co=enable&action=recalc&qty=#thisOtherThing#"
method="post">
<input size="1" type="Text" value="#form.WhateverDude#"
name="current_qty" />
<input type="button" value="+" name="qty_up"
onclick="a=parseFloat(document.qty_adjust#theid#.current_qty.value);b=a+1;document.qty_adjust#theid#.current_qty.value=b;if(b>=#getinfo.units_in_stock#){document.qty_adjust#theid#.current_qty.value=#getinfo.units_in_stock#;alert('You
can only have #getinfo.units_in_stock# items at this time.');}" />
<input type="button" value="-" name="qty_down"
onclick="a=parseFloat(document.qty_adjust#theid#.current_qty.value);b=a-1;document.qty_adjust#theid#.current_qty.value=b;if(b<1){document.qty_adjust#theid#.current_qty.value=1;alert('You
cannot have less then 1 item. To remove this item from your cart
please push the DELETE button');}">
<input type="Hidden" value="#theid#" name="prodID" />
<input type="Hidden" value="#form.current_qty#" name="WhateverDude">
<INPUT TYPE="SUBMIT" VALUE="RECALCULATE THE WHOLE TOTAL" NAME="QTY_SUBMIT">
</td><td>
.......
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to
date
Get the Free Trial
http://ad.doubleclick.net/clk;160198600;22374440;w
Archive:
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:300815
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe:
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4