I was wondering if I need to lock this, I have locking enabled in my
application.cfm for sessions?
<CFSCRIPT>
if (not(isDefined("session.cart"))){
session.cart = structNew();
}
// The item structure we will define is as follows
// 1. sysModelNum
// 2. qty
tempValue = listToArray('#attributes.ID#,
#attributes.sysModelNum#,
#attributes.price#,
#attributes.qty#,
#attributes.cse#,
#attributes.cpu#,
#attributes.ram#,
#attributes.hdd#,
#attributes.sec_hdd#,
#attributes.mtr#,
#attributes.ctr#,
#attributes.vid#,
#attributes.snd#,
#attributes.cdr#,
#attributes.dvd#,
#attributes.crw#,
#attributes.mdm#,
#attributes.stg#,
#attributes.spk#,
#attributes.nic#,
#attributes.clng#,
#attributes.os#,
#attributes.war#');
// Check to make sure that the item is in the cart, and if it
is not, add it.
if
(not(structKeyExists(session.cart,attributes.ID))) {
structInsert(session.cart,attributes.ID,tempValue,true);
}
else {
// If the item is already in the cart update the quantity
tempvalue[4]=attributes.qty;
structUpdate(session.cart,attributes.ID,tempvalue);
}
</CFSCRIPT>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Structure your ColdFusion code with Fusebox. Get the official book at
http://www.fusionauthority.com/bkinfo.cfm
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists