macromedia.coldfusion.getting_started
[Top] [All Lists]

coldfusion Shop cart Confusion

Subject: coldfusion Shop cart Confusion
From: "newchickinCF"
Date: Mon, 25 Aug 2008 06:51:29 +0000 UTC
Newsgroups: macromedia.coldfusion.getting_started

Hi I am building shopping cart with Micheal's Tutorial Using Arrays and 
sessions. But i am stuck at the point where i need to store the order details 
in the database before the payment button is clicked and actually it go to 
paypal to process the order: 

 i am doing something like this. 

 <cfquery name="addOrder" datasource="#application.dsn#"> 
 INSERT INTO orders (o_cust, o_total, o_items,o_quantity,ipaddress) 
 VALUES ( 
 <cfqueryparam cfsqltype="cf_sql_numeric" value="#logMem.c_id#">, 
 <cfqueryparam cfsqltype="cf_sql_double" value="#variables.totalprice#">, 
 <cfoutput> 
 <cfloop from="1" to="#arrayLen(session.shoppingcart)#" index="i"> 
      <cfif i eq arrayLen(session.shoppingcart)> 
          <cfqueryparam cfsqltype="cf_sql_varchar" 
value="#session.shoppingcart.name#"> 
                <cfelse> 
                  <cfqueryparam cfsqltype="cf_sql_varchar" 
value="#session.shoppingcart.name#"> 
      </cfif> 
 </cfloop> 
 </cfoutput>, 
 <cfoutput> 
 <cfloop from="1" to="#arrayLen(session.shoppingcart)#" index="i"> 
      <cfif i eq arrayLen(session.shoppingcart)> 
           <cfqueryparam cfsqltype="cf_sql_varchar" 
value="#session.shoppingcart.quantity#"> 
                <cfelse> 
                     <cfqueryparam cfsqltype="cf_sql_varchar" 
value="#session.shoppingcart.quantity#"> 
      </cfif> 
 </cfloop> 
 </cfoutput>, 
 <cfqueryparam cfsqltype="cf_sql_varchar" value="#CGI.REMOTE_ADDR#">) 
 </cfquery> 

 if i enter as above it creates only 1 row and enters the info like: 

 o_items as product1product2 and o_quantity as: 23 

 and i am unable to identify the products and quantity through database as it 
looks like item product1product2 has been purchased with quantity 23 

 can anyone guide how can i do it.. 

 If you can Suggest e database change, Pease reply , I will do that because 
this is something confusing me last 3 days 

 Cheers


<Prev in Thread] Current Thread [Next in Thread>
  • coldfusion Shop cart Confusion, newchickinCF <=