Also,

<select name="selectSize#Replace(ItemIDPK,"-","_","ALL")#">

<cfloop index = "ListElement" list = "
#ValueList(GetCartItems.ItemsItemSize)#">
<cfif #ListElement# eq GetCartItems.CartItemsItemSize> <!--- preselect it --->
<option value="#ListElement#" selected>#ListElement#</option>
<cfelse>
<option value="#ListElement#">#ListElement#</option>
</cfif>
</cfloop>
</select>

Becomes :
<select name="selectSize#Replace(ItemIDPK,"-","_","ALL")#">
<cfloop index = "ListElement" list = "#ValueList(GetCartItems.ItemsItemSize)#">
<option value="#ListElement#" #IIF(ListElement eq GetCartItems.CartItemsItemSize,DE('selected'),DE('')#>#ListElement#</option>
</cfloop>
</select>


and


<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")#"]>

Becomes :

<cfset FormItemID = Replace(ItemIDPK,"-","_","ALL")>
<cfset FormQuantity = Form["Quantity"&FormItemID]>
<cfset FormSelectSize = 0>
<cfif IsDefined("Form.SelectSize"&FormItemID)>
   <cfset FormSelectSize = Form["SelectSize"&FormItemID]>
</cfif>

<CFIF CartItems.Quantity NEQ  FormQuantity
    AND IsNumeric(FormQuantity)
    AND FormQuantity LTE 1000
    OR CartItems.ItemSize NEQ FormSelectSize>

<!--- Update Quantity in Cart --->
       <CFQUERY  name="ChangeQuantity" datasource="#application.dsn#">
           UPDATE tblCartItems
           SET Quantity = #FormQuantity#,
           <cfif FormSelectSize GT 0>
           itemsize = '#FormSelectSize#'
           </cfif>
           WHERE CartIDPK = '#Cookie.CartID#'
           AND ItemIDPK = #CartItems.ItemIDPK#
       </cfquery>

I haven't really done anything to your code, just set variables for the REPLACE() functions and removed the use of #'s when concatenation is possible. In the form select the IIF inside the option has replaced the <cfif> around the two possible options.

Hope that helps

Regards

Stephen


-- 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