Re: How to loop over this struct and give me a total?

2005-04-28 Thread Joe Rinehart
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

Re: How to loop over this struct and give me a total?

2005-04-28 Thread Jared Rypka-Hauer - CMG, LLC
Mostly because it's uber simple at this point and growing toward a deeper OO implementation and because it takes a great deal of explanation to take a strong CF developer to a well-formed OO implementation. For someone who's working with example code from some other source and getting

Re: How to loop over this struct and give me a total?

2005-04-28 Thread Will Tomlinson
Yep, I'm still just a rookie, but I'm gettin' there! I just know two things about this function and calling it. 1. I understand it. 2. It works. 3. It's simple Ok, that was three things. Thanks for your input Joe. I'm just trying to keep my head above water right now. :) preesh as usual

How to loop over this struct and give me a total?

2005-04-27 Thread Will Tomlinson
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

re: How to loop over this struct and give me a total?

2005-04-27 Thread dave
You mean it's not in the book? From: Will Tomlinson [EMAIL PROTECTED] Sent: Wednesday, April 27, 2005 10:13 PM To: CF-Talk cf-talk@houseoffusion.com Subject: How to loop over this struct and give me a total? I'm having brain lock again. I've built a

Re: How to loop over this struct and give me a total?

2005-04-27 Thread Jared Rypka-Hauer - CMG, LLC
Dave, you're a twit. ;) Will... that's messy. :) 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 =

Re: How to loop over this struct and give me a total?

2005-04-27 Thread Will Tomlinson
Here's my final working code. Thanks J - no thanks go to dave! :) cffunction name=GetCartTotal access=public returntype=numeric output=true hint=Show total of cart in dollars cfset var cartTotal = 0 cfloop collection=#VARIABLES.cart# item=thismerchID cfset

Re: How to loop over this struct and give me a total?

2005-04-27 Thread dave
thats the code you been working on all this time?? haha From: Will Tomlinson [EMAIL PROTECTED] Sent: Wednesday, April 27, 2005 11:35 PM To: CF-Talk cf-talk@houseoffusion.com Subject: Re: How to loop over this struct and give me a total? Here's my final