Perhaps this?

<!------------------------------------------------------------------------------------------
 'UPDATE' function
 
------------------------------------------------------------------------------------------>
<cfelseif Attributes.Function eq "update">
    
<!--------------------------------------------------------------------------------------
     store the cart into a temporary variable
     
-------------------------------------------------------------------------------------->
    <cfset SC_temp = Evaluate(SC_cart) >
        
<!----------------------------------------------------------------------------------
         check to see if the item already exists in the cart
         
---------------------------------------------------------------------------------->
        <cfif ListContains(SC_temp, Attributes.Item, "*") >
            
<!------------------------------------------------------------------------------
             set the position of the item in the 'main list'
             
------------------------------------------------------------------------------>
            <cfset SC_position = ListContains(SC_temp, Attributes.Item, "*") >
            
<!------------------------------------------------------------------------------
             set the sub-list in the 'main list' to a temporary variable
             
------------------------------------------------------------------------------>
            <cfset SC_item = ListGetAt(SC_temp, SC_position, "*") >
            
<!------------------------------------------------------------------------------
             change the quantity in the sub-list
             
------------------------------------------------------------------------------>
            <cfset SC_item = ListSetAt(SC_item, 2, SC_qty, "&") >
            
<!------------------------------------------------------------------------------
             change the value of the entry in the 'main list'
             
------------------------------------------------------------------------------>
            <cfset SC_temp = ListSetAt(SC_temp, SC_position, SC_item, "*") >
        </cfif>
    
<!--------------------------------------------------------------------------------------
     loop for each item in the cart
     
-------------------------------------------------------------------------------------->
    <cfloop index="SC_index" list="#SC_temp#" delimiters="*">
        
<!----------------------------------------------------------------------------------
         set the item and quantity variables in the calling template
         
---------------------------------------------------------------------------------->
        <cfset caller.ShoppingCart_Qty   = ListAppend(caller.ShoppingCart_Qty, 
ListGetAt(SC_index, 2, "&")) >
        
<!----------------------------------------------------------------------------------
         set the count variable in the caller template
         
---------------------------------------------------------------------------------->
        <cfset caller.ShoppingCart_Items = caller.ShoppingCart_Items + 
ListGetAt(SC_index, 2, "&") >
    </cfloop>

-- 
***********************************************
 Jon Tillman
 LINUX USER: #141163
 ICQ: 4015362
 http://www.eruditum.org
 [EMAIL PROTECTED]
***********************************************
Help Jon build a network!
Looking for giveaway computers & parts
Current Need: Tape Drive & PI/PII processors
Email me to find out how you can help
***********************************************

------------------------------------------------------------------------------
Archives: http://www.mail-archive.com/[email protected]/
To Unsubscribe visit 
http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk or send a 
message to [EMAIL PROTECTED] with 'unsubscribe' in the body.

Reply via email to