I'm having brain lock again. 

I've built a function that should loop over a struct and give me a total for 
the cart items. Could someone point me in the right direction?

here's what the struct looks like:

<cfset variables.cart["#ARGUMENTS.merchID#"] = StructNew()>
<cfset variables.cart["#ARGUMENTS.merchID#"]["qty"] = #ARGUMENTS.quantity#>
<cfset variables.cart["#ARGUMENTS.merchID#"]["price"] = #ARGUMENTS.price#>
<cfset variables.cart["#ARGUMENTS.merchID#"]["subtotal"] = ARGUMENTS.price# * 
#ARGUMENTS.quantity#>

And here's the function I need to build to get a running total. 

<cffunction name="GetCartTotal" access="public" returntype="numeric" 
output="true" hint="Show total of cart in dollars">
<cfloop collection="#VARIABLES.cart#" item="thismerchID">
<cfset carttotal = VARIABLES.cart["#thismerch#"]["subtotal"]??????>
                
                </cfloop>
                </cffunction>

Thanks,
Will


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Logware (www.logware.us): a new and convenient web-based time tracking 
application. Start tracking and documenting hours spent on a project or with a 
client with Logware today. Try it for free with a 15 day trial account.
http://www.houseoffusion.com/banners/view.cfm?bannerid=67

Message: http://www.houseoffusion.com/lists.cfm/link=i:4:204873
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

Reply via email to