Woo Hoo persitance and outputting variables in code has fixed it.

I now have this at the moment ....

<CFLOOP query="CartItems">
<cfset thing = ListFindNoCase(Form.FIELDNAMES,"SelectSize"&Replace(ItemIDPK,"-","_","ALL"))>
<cfoutput>#thing#</cfoutput>
<cfif #thing# eq 0>
<CFSET NewQuantity = Form["Quantity#Replace(ItemIDPK,"-","_","ALL")#"]>
<CFQUERY name="ChangeQuantity" datasource="#application.dsn#">
UPDATE tblCartItems
SET Quantity = #Val(Variables.NewQuantity)#
WHERE CartIDPK = '#Cookie.CartID#'
AND ItemIDPK = #CartItems.ItemIDPK#
</cfquery>
<cfelse>


<!--- If the cached quantity changed... --->
<CFIF CartItems.Quantity NEQ Form["Quantity#Replace(ItemIDPK,"-","_","ALL")#"]
AND IsNumeric(Form["Quantity#Replace(ItemIDPK,"-","_","ALL")#"])
AND Form["Quantity#Replace(ItemIDPK,"-","_","ALL")#"] LTE 1000
OR CartItems.ItemSize NEQ Form["SelectSize#Replace(ItemIDPK,"-","_","ALL")#"]>
<!--- Store new Quantity in a temporary Variable --->
<CFSET NewQuantity = Form["Quantity#Replace(ItemIDPK,"-","_","ALL")#"]>
<CFSET NewSize = Form["SelectSize#Replace(ItemIDPK,"-","_","ALL")#"]>
<!--- Update Quantity in Cart --->
<CFQUERY name="ChangeQuantity" datasource="#application.dsn#">
UPDATE tblCartItems
SET Quantity = #Val(Variables.NewQuantity)#,
<cfif NewSize neq "">
itemsize = '#newsize#'
</cfif>
WHERE CartIDPK = '#Cookie.CartID#'
AND ItemIDPK = #CartItems.ItemIDPK#
</cfquery>
</cfif>
</cfif>
</CFLOOP>


Its a little crude and there are some didgy fieldnames but I understand how it works and I can now go about making it better :)

Many thanks go to Duncan, Stephen and all those who helped me over the last couple of nights.

All I have to do now is replicate all this for the colour  .... :(

Regards - Paul



--
These lists are syncronised with the CFDeveloper forum at 
http://forum.cfdeveloper.co.uk/
Archive: http://www.mail-archive.com/dev%40lists.cfdeveloper.co.uk/

CFDeveloper Sponsors and contributors:-
*Hosting and support provided by CFMXhosting.co.uk* :: *ActivePDF provided by 
activepdf.com*
     *Forums provided by fusetalk.com* :: *ProWorkFlow provided by proworkflow.com*
          *Tutorials provided by helmguru.com* :: *Lists hosted by gradwell.com*

To unsubscribe, e-mail: [EMAIL PROTECTED]



Reply via email to