Hi Everyone,

I have a really strange issue that I can not figure out how to fix it.  I 
have a simple shopping cart and everything works exactly the way it should 
in ie7 & ie8 but firefox not so much.
This is the issue.  When customer clicks on the item to add to cart it first 
checks to see if the item is already in the cart.  If not, insert new 
record.  If found, update the record and add 1 to the qty. Within IE this 
works just as it should, Firefox runs the update query regardless of new 
insert or not.  example.  item ABC new to cart with qty 1  if I look at the 
database table I see the qty is 2.  If the item is already in database with 
qty 1 and item is added to cart the qty is now 3.  I've turned on debug and 
looked at all queries ran and the the correct queries do show.

It's like there is another update query someplace but there isn't.  I tested 
this by removing the query named "updatecart" and tried the process again 
and new records do get added and the qty is correct with 1 not 2.  With it 
being removed and item is updated to cart. it doesn't get updated like it 
should be.

This is very very weird!

The code that I'm having strange is the following.  I just copied the bit 
that I need to show.
Anybody seen this before?

Thanks,
Dan Blickensderfer


<cfquery name="lookupcart" datasource="#application.datasource#" 
username="#application.username#" password="#application.password#">
   select rec_id
   from order_items
   where rec_status = 'T' and session_uuid = <cfqueryparam 
cfsqltype="cf_sql_varchar" maxlength="36" value="#session.cartid#"> and 
products_rec_id = <cfqueryparam cfsqltype="cf_sql_integer" 
value="#variables.recid#">
  </cfquery>
  <cfif lookupcart.recordcount is 0>
   <cfquery name="addcart" datasource="#application.datasource#" 
username="#application.username#" password="#application.password#">
    insert into order_items (rec_status, session_uuid, products_rec_id, 
product_name, qty, orders_rec_id, ip_address)
       values ('T', <cfqueryparam cfsqltype="cf_sql_varchar" maxlength="36" 
value="#session.cartid#">,
       <cfqueryparam cfsqltype="cf_sql_integer" value="#variables.recid#">,
       <cfqueryparam cfsqltype="cf_sql_varchar" 
value="#getproduct.product_name#" maxlength="150">,
       <cfqueryparam cfsqltype="cf_sql_integer" value="1">,
       <cfqueryparam cfsqltype="cf_sql_integer" 
value="#lookuporder.rec_id#">,
       <cfqueryparam cfsqltype="cf_sql_varchar" 
value="#trim(cgi.REMOTE_ADDR)#" maxlength="17">)
   </cfquery>
  <cfelse>
   <cfquery name="updatecart" datasource="#application.datasource#" 
username="#application.username#" password="#application.password#">
    update order_items
    set qty = qty + 1
    where rec_status = 'T' and rec_id = <cfqueryparam 
cfsqltype="cf_sql_integer" value="#lookupcart.rec_id#">
   </cfquery>
  </cfif>


Here is the debug info

lookupcart (Datasource=XYX, Time=0ms, Records=0) in 
templates\includes\cart-add.cfm @ 18:50:44.044

                        select *
                        from order_items
                        where rec_status = 'T' and session_uuid = ? and 
products_rec_id = ? Query 
Parameter Value(s) -
Parameter #1(cf_sql_varchar) = 69B9132F-943D-2A28-E56878FCFEA4A5B6
Parameter #2(cf_sql_integer) = 17

addcart (Datasource=XYX, Time=0ms, Records=1) in 
templates\includes\cart-add.cfm @ 18:50:44.044

                                insert into order_items (rec_status, 
session_uuid, products_rec_id, 
product_name, qty, orders_rec_id, ip_address)
                                                        values ('T', ?,
                                                        ?,
                                                        ?,
                                                        ?,
                                                        ?,
                                                        ?)
                        Query Parameter Value(s) -
Parameter #1(cf_sql_varchar) = 69B9132F-943D-2A28-E56878FCFEA4A5B6
Parameter #2(cf_sql_integer) = 17
Parameter #3(cf_sql_varchar) = Green, Yellow & Orange
Parameter #4(cf_sql_integer) = 1
Parameter #5(cf_sql_integer) = 5014
Parameter #6(cf_sql_varchar) = 192.168.10.159 




~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:343833
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm

Reply via email to