Tally List : mailing list management, archiving, and analysis
click for archive home
 
Archive of:
CF-Talk
Cold Fusion - Technical
 
home
24 hour view
quick stats
weekly updates
 
all tallylists
corporate solutions
archive your favorite
help / feedback


Search the Tallylist search by keyword:

About Cold Fusion :
product's home
product's list home
 
  Archived TallyList / CF-Talk: 
Subject: Help with a <cfscript>
ibtoad (90p/+0r)     Posted: Monday 12 Mar 2001
This post: 51 views, +0 rating

I have been playing around with a tutorial and it has a section of a cart written in <cfscript> which I really don't understand. Can someone please decode this into regular CF. Here is the script:

<cfscript> if (not(isdefined("session.cart"))) { // Check to make sure that the Shopping cart structure exists. session.cart = structnew(); }

// The item structure we are going to use to store the items in the cart // is going to have four parts... // 1. The item id // 2. The item name // 3. The price per unit // 4. The quantity

tempvalue = listtoarray('#attributes.id#,#attributes.name#,#attributes.price#,#attribute s.quantity#');

// if the item is not yet in the cart, simply add it to the cart if (not(structKeyExists(session.cart, attributes.name))) { StructInsert(session.cart,attributes.name,tempvalue);

}

// if the item is already in the cart, update the item quantity else { tempvalue[4]=session.cart[attributes.name][4]+attributes.quantity; StructUpdate(session.cart,attributes.name,tempvalue); } </cfscript>

Thanks, Rich


Similar Subject Line Posts (+/- two weeks of this post)
RE: Help with a <cfscript>  12 Mar 2001   (40 v/ +0 r)
Help with a <cfscript>  12 Mar 2001 (this post)   (51 v/ +0 r)
 

Send a reply to the CF-Talk list!
click to send a reply! NOTE: Many lists will reject your post unless you have already registered with them. Also - don't forget the right account to send from (for those with multiple emails!)

Feedback: If this post was exceptionally helpful, please help by giving this post a positive review.

 

TallyList : copyright Ububik - 2000