Will,
Why do you reference variables.cart in your function? It'd be more of
a best practice to pass GetCartTotal the cart in question, like so:
<cffunction name="GetCartTotal" access="public" returntype="numeric"
output="true" hint="Show total of cart in dollars">
<cfargument name="cart" required="true" type="struct" hint="I am the
cart to total">
<cfset var cartTotal = 0>
<!--- Don't forget implicity created variables need declaration too! --->
<cfset thismerchID = "">
<cfloop collection="#arguments.cart#" item="thismerchID">
<cfset cartTotal = cartTotal + arguments.cart[thismerchID]["subtotal"]>
</cfloop>
<cfreturn cartTotal>
</cffunction>
Then, in your calling code, do:
GetCartTotal(variables.cart) instead of GetCartTotal()
-Joe
--
Get Glued!
The Model-Glue ColdFusion Framework
http://www.model-glue.com
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
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:204894
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=11502.10531.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54