Michel,

Let me make ssure I understand what you're trying to do. You're using a
query to store your shopping cart data, and you need to delete a row
from the shopping cart.

If such is the case then what you need to do is create a new query and
include all rows from your old query except for the rows you want to
delete. As in:

<!--- this is the action page. The user has already selected which items
to delete from a form on the previous page --->

<!--- First, check to make sure that there is a delete items list --->
<CFIF isDefined("attributes.DeleteItem")>

<!--- set up the new shopping cart --->
<CFSET NewCart = 
querynew("SKU,styleNo,Description,QTY,Price,Cost,size,saleDate")>

<!--- Loop over the old cart --->
<CFLOOP QUERY="Request.YourCart">

<!--- is the item is not in the deleted items list? If so, then include
it with new cart --->
<CFIF NOT ListFindNoCase(attributes.DeleteItem,sku)>
     <CFSCRIPT>
          queryAddRow(NewCart);     
          querySetCell(NewCart,"SKU",Request.YourCart.SKU);
          querySetCell(NewCart,"StyleNo",Request.YourCart.styleNo);
         
querySetCell(NewCart,"Description",Request.YourCart.Description);
          querySetCell(NewCart,"Price",Request.YourCart.Price);
          querySetCell(NewCart,"Qty",Request.YourCart.Qty);
          querySetCell(NewCart,"Cost",Request.YourCart.Cost);
          querySetCell(NewCart,"Size",Request.YourCart.Size);
          querySetCell(NewCart,"SaleDate",Request.YourCart.SaleDate);
     </CFSCRIPT>
</CFIF>

</CFLOOP>

<!--- Now set the old shopping cart's value to the new one. Remember to 
      use cflock if you have session or application variables. --->
<CFLOCK TIMEOUT="30" THROWONTIMEOUT="Yes" TYPE="EXCLUSIVE">
     <CFSET session.YourCart = NewCart>
</CFLOCK>

     <CFSET request.YourCart = NewCart>
</CFIF> 

hth,
larry

-- 
Larry C. Lyons
ColdFusion/Web Developer
EBStor.com
8870 Rixlew Lane, Suite 201
Manassas, Virginia 20109-3795
tel: (703) 393-7930 x253
fax: (703) 393-2659
http://www.ebstor.com
http://www.pacel.com
email: [EMAIL PROTECTED]

Chaos, panic, and disorder - my work here is done.
--

Michel Gagnon wrote:
> 
> Hi!
> 
> I've got a shopping basket going:
> 
> <cfset tempValue = queryAddRow(session.basket)>
> <cfset tempValue = querySetCell(session.basket, "ID",  form.ID)>
> <cfset tempValue = querySetCell(session.basket, "Quantity", form.quantity)>
> 
> But I can't find the instructions on how to delete items
> from the basket.
> 
>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Structure your ColdFusion code with Fusebox. Get the official book at 
http://www.fusionauthority.com/bkinfo.cfm

Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to