On Mon, Sep 8, 2008 at 12:54 PM, Jeff F <[EMAIL PROTECTED]> wrote:

> I've got a simple cart that stores items in an array.
>
> I keep a running total of the items in the cart looping through:
>
> <cfloop collection="#session.cart#" item="i">
> <cfset numberofitems  =  numberofitems  + session.cart[i][4]>
> </cfloop>
>
> 4 is quantity of that item in the array.
>
> What I'd need is to have a running total of items, that does not include a
> certain item, based on the 8th element of the array where I store
> "category".
>
> Something like:
>
> <cfloop collection="#session.cart#" item="i">
> <cfset numberofitems  =  numberofitems  + session.cart[i][4] where
> session.cart[8} is not 22>
> </cfloop>
>

there's probably a cleaner implementation, but this should work:

<cfloop collection="#session.cart#" item="idx">
     <cfif session.cart[idx][8] is not 22>
          <cfset numberOfItems = numberOfItems + session.cart[idx][4] />
     </cfif>
</cfloop>

-- 
I have failed as much as I have succeeded. But I love my life. I love my
wife. And I wish you my kind of success.


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to 
date
Get the Free Trial
http://ad.doubleclick.net/clk;203748912;27390454;j

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:312206
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4

Reply via email to