Well here is the struct, I did a <CFDUMP> and got the following results..
Struct
<CFLOCK scope="SESSION" timeout="20">
<CFSCRIPT>
if (not(isDefined("session.cart"))){
session.cart = structNew();
}
// create a temp structure
tempValue = StructNew();
StructInsert(tempValue, "sysModelNum", attributes.sysModelNum);
StructInsert(tempValue, "show_price_top", FORM.show_price_top);
StructInsert(tempValue, "qty", attributes.qty);
StructInsert(tempValue, "cse", attributes.cse);
StructInsert(tempValue, "cpu", attributes.cpu);
StructInsert(tempValue, "ram", attributes.ram);
StructInsert(tempValue, "hdd", attributes.hdd);
StructInsert(tempValue, "sec_hdd", attributes.sec_hdd);
StructInsert(tempValue, "mtr", attributes.mtr);
StructInsert(tempValue, "ctr", attributes.ctr);
StructInsert(tempValue, "vid", attributes.vid);
StructInsert(tempValue, "snd", attributes.snd);
StructInsert(tempValue, "cdr", attributes.cdr);
StructInsert(tempValue, "dvd", attributes.dvd);
StructInsert(tempValue, "crw", attributes.crw);
StructInsert(tempValue, "modem", attributes.modem);
StructInsert(tempValue, "stg", attributes.stg);
StructInsert(tempValue, "spk", attributes.spk);
StructInsert(tempValue, "nic", attributes.nic);
StructInsert(tempValue, "clng", attributes.clng);
StructInsert(tempValue, "os", attributes.os);
StructInsert(tempValue, "war", attributes.war);
/* check if the model number is in the cart, and if it is, update your temp
structure with the new quantity */
if (structKeyExists(session.cart,attributes.sysModelNum)) {
newquantity = attributes.qty;
StructInsert(tempValue, "qty", newquantity, true);
}
/* now update the cart. This will either add a new structure, or overwrite
an existing one with an updated quantity */
StructInsert(session.cart,attributes.sysModelNum,tempValue, true);
</CFSCRIPT>
</CFLOCK>
<CFOUTPUT>
<CFDUMP var = #session.cart#>
</CFOUTPUT>
Results of dump, the center one is the one it is trying to output back to
the page.
TEST-SYS1 CDR none
CLNG none
CPU test-cpu2
CRW none
CSE test-cse3
CTR none
DVD none
HDD test-hdd1
MODEM none
MTR none
NIC none
OS test-os1
QTY 1
RAM test-ram1
SEC_HDD none
SHOW_PRICE_TOP 2748
SND none
SPK none
STG none
SYSMODELNUM test-sys1
VID test-vid1
WAR warranty
TEST-SYS1,TEST-SYS2 CDR none,none
CLNG none,none
CPU test-cpu2,test-cpu5
CRW none,none
CSE test-cse3,test-cse2
CTR none,none
DVD none,none
HDD test-hdd1,test-hdd1
MODEM none,test-modem1
MTR none,none
NIC none,none
OS test-os1,test-os1
QTY 1,20
RAM test-ram1,test-ram1
SEC_HDD none,none
SHOW_PRICE_TOP 2748,2673
SND none,none
SPK none,none
STG none,none
SYSMODELNUM test-sys1,test-sys2
VID test-vid1,test-vid1
WAR warranty,warranty
TEST-SYS2 CDR none
CLNG none
CPU test-cpu5
CRW none
CSE test-cse2
CTR none
DVD none
HDD test-hdd1
MODEM test-modem1
MTR none
NIC none
OS test-os1
QTY 1
RAM test-ram1
SEC_HDD none
SHOW_PRICE_TOP 2673
SND none
SPK none
STG none
SYSMODELNUM test-sys2
VID test-vid1
WAR warranty
----- Original Message -----
From: "Tim Stadinski" <[EMAIL PROTECTED]>
To: "CF-Talk" <[EMAIL PROTECTED]>
Sent: Thursday, November 01, 2001 2:07 PM
Subject: RE: structure ?
> can you provide a source snippet?
>
> tim
>
> -----Original Message-----
> From: Douglas L. Brown [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, November 01, 2001 4:29 PM
> To: CF-Talk
> Subject: structure ?
>
>
> I have a struct that adds and updates a shopping cart, and I get an
> error when updating the cart when their is more than one item. It is
> sending a comma delimeted list of the values to the structure for update
> and when it tries to display the values it is also comma delimeted and
> causes the errror. It is not updating the item based upon the identifier
> which in this case is "sysModelNum". If I have lets say model1 and model
> 2 in the cart and hit the update button it will try to display model1
> and model2 in the same field. Can someone tell me what I may be doing
> wrong.
>
>
>
>
> <CF_SIGNATURE
> NAME="Douglas L. Brown"
> EMAIL="[EMAIL PROTECTED]"
> PHONE="714.538.6611"
> WEB="http://www.carnivorepc.com">
>
>
>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Your ad could be here. Monies from ads go to support these lists and provide more
resources for the community. http://www.fusionauthority.com/ads.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