I am sorry for this message I was not thinking good this morning. I just
needed to replace
<cfset total_quantity[Counter] = #discount_array[Counter]#>
with
<cfset total_quantity =#ArraySum(discount_array)#>
-----Original Message-----
From: Matt Jezorek [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, October 04, 2000 11:59 AM
To: CF-Server
Subject: Counting Quantity to determine a discount cross many products
I am working on a cart where the owner wants to be able to sell candles. He
wants to discount certain sizes i.e. if you buy 100 small candles he wants
to knock the price down .50 cents per candle. I have done that part. It was
simple. However he also sells many designs of small candles and wants it to
be discounted reguardless of any design just as long as it is a small
candle. This is what I have right now. I am sure it is wrong but I am really
needing some help or ideas on how to count quantities based on size from a
recordset
This is the code I am using currently or trying to work on but stumped
<cfquery name="array" datasource="chandlerscandles">
Select quantity
FROM cart
where cfid = '#session.cfid#'
and orderid = #session.orderid#
and size = 'Small Favor'
</cfquery>
<cfif #array.recordcount# GTE 1>
<cfset discount_array = ArrayNew(1)>
<cfloop query="array">
<cfset discount_array[CurrentRow] = array.quantity[CurrentRow]>
</cfloop>
<CFSET Total_Records = array.recordcount>
<cfloop index="Counter" from=1 to="#Total_Records#">
<!--- <cfoutput>#discount_array[Counter]#</cfoutput> --->
<cfset total_quantity[Counter] = #discount_array[Counter]#>
</cfloop>
<cfif #total_quantity# GTE 100>
<cfset discount_needed = true>
<cfelse>
<cfset discount_needed = false>
</cfif>
<cfoutput>#total_quantity#</cfoutput>
</cfif>
----------------------------------------------------------------------------
--
To unsubscribe, send a message to [EMAIL PROTECTED] with
'unsubscribe' in the body or visit the list page at www.houseoffusion.com
------------------------------------------------------------------------------
To unsubscribe, send a message to [EMAIL PROTECTED] with
'unsubscribe' in the body or visit the list page at www.houseoffusion.com