<cfswitch expression="#action#">
<cfcase value=“getCart”>
<cfparam name=“session.cart” default="#ArrayNew(1)#">
<cfset cartQuery = QueryNew(“qty,upc,title,image,price”)>
<cfloop from=“1” to="#ArrayLen(session.cart)#" index=“i”>
<cfset queryAddRow(cartQuery)>
<cfset querySetCell(cartQuery, “qty”, session.cart*.qty, i)>
<cfset querySetCell(cartQuery, “upc”, session.cart*.upc, i)>
<cfset querySetCell(cartQuery, “title”, session.cart*.title, i)>
<cfset querySetCell(cartQuery, “image”, session.cart*.image, i)>
<cfset querySetCell(cartQuery, “price”, session.cart*.price, i)>
</cfloop>
<cfset request.response = cartQuery>
</cfcase>
[COLOR=Red]<cfcase value=“addToCart”>
<cfparam name=“session.cart” default="#ArrayNew(1)#
<cfhttp url=“http://webservices.amazon.com/onca/xml?Service=AWSECommerceService&
AWSAccessKeyId=1MEQ9VMKAJS5A8DSHER2&Operation=ItemLookup&IdType=UPC&SearchIndex=DVD
&ItemId=#url.upc#&ResponseGroup=Small,ItemAttributes,Images” throwOnError="yes"
charset=“UTF-8”></cfhttp>
<cfset myXMLdoc = XmlParse(cfhttp.filecontent)>
<CFSET xnProduct = myXMLdoc.xmlRoot>
<cfscript>
addItem = StructNew();
addItem.qty = 1;
addItem.upc = xnProduct.Items.Item.ItemAttributes.UPC.XmlText;
addItem.title = xnProduct.Items.Item.ItemAttributes.Title.XmlText;
addItem.image = xnProduct.Items.Item.SmallImage.URL.XmlText;
addItem.price = xnProduct.Items.Item.ItemAttributes.ListPrice.FormattedPrice.XmlText;[/COLOR]
</cfscript>
<cfset ArrayAppend(session.cart,addItem)>
<cfset cartQuery = QueryNew(“qty,upc,title,image,price”)>
<cfloop from=“1” to="#ArrayLen(session.cart)#" index=“i”>
<cfset queryAddRow(cartQuery)>
<cfset querySetCell(cartQuery, “qty”, session.cart*.qty, i)>
<cfset querySetCell(cartQuery, “upc”, session.cart*.upc, i)>
<cfset querySetCell(cartQuery, “title”, session.cart*.title, i)>
<cfset querySetCell(cartQuery, “image”, session.cart*.image, i)>
<cfset querySetCell(cartQuery, “price”, session.cart*.price, i)>
</cfloop>
<cfset request.response = cartQuery>
<cfcase value=“clearCart”>
<cfset ArrayClear(session.cart)>
<cfset cartQuery = QueryNew(“qty,upc,title,image,price”)>
<cfset request.response = cartQuery>
</cfcase>
</cfswitch
></cfcase>
ok this is the cart.cfm page i believe all i would have to change is the red syntax. is that true? and if so how do i go about linking my database to it? so it uses the items on the database and not amazon web service.