I was just wondering if anyone here have experienced the same situation I'm in
right now. In a nutshell, I'm noticing on my ecommerce website the cookie holding
the shopping cart ID is being dropped after several clicks through the website
only with IE browsers. With the same code, it works just fine with
FireFox/Netscape browers.
Here's how my database driven shopping cart works on my site. In the
Application.cfm I have these lines of code:
<!--- --------------------------
----------
----------
----------
----------
-- --->
<!--- SHOPPING CART RELATED FUNCTIONS START HERE --->
<!--- --------------------------
----------
----------
----------
----------
-- --->
<cfif NOT IsDefined("COOKIE.LastCart
ID")>
<!--- Set a cookie if the user decides to purchase later --->
<cfset newCCID = #CreateUUID()#>
<cfcookie name="LastCartID" value="#newCCID#">
<!--- Insert tracking variables here --->
<cfquery username="#application.qry
UserName#"
password="#application.qry
Password#"
name="checkTransID" datasource="#Application.D
SN#" dbtype="ODBC">
SELECT OrderTransID
FROM tblOrderTransactions
WHERE OrderTransID = '#SESSION.CFTOKEN#'
</cfquery>
<!--- If no record, create new order transaction ID --->
<cfif CompareNoCase(checkTransID
.RecordCou
nt,1)>
<cfquery username="#application.qry
UserName#"
password="#application.qry
Password#"
name="createEZaccount" datasource="#Application.D
SN#" dbtype="ODBC">
INSERT INTO tblOrderTransactions(Order
TransID,Cu
stIP)
VALUES('#SESSION.CFTOKEN#'
,'#CGI.REM
OTE_ADDR#'
);
</cfquery>
</cfif>
<!--- Create CartID in SESSION var --->
<cflock timeout="30" throwontimeout="No" name="#SESSION.SessionID#"
type="EXCLUSIVE">
<cfset SESSION.CartID = COOKIE.LastCartID>
</cflock>
</cfif>
<cfif NOT IsDefined("SESSION.CartID"
)>
<cflock timeout="30" throwontimeout="No" name="#SESSION.SessionID#"
type="EXCLUSIVE">
<cfset SESSION.CartID = COOKIE.LastCartID>
</cflock>
</cfif>
<cfparam name="thisCartID" default="#COOKIE.LastCartI
D#">
<!--- --------------------------
----------
----------
----------
----------
-- --->
<!--- --------------------------
----------
----------
----------
----------
-- --->
A first time visitor will have a new cart ID created and saved to a cookie
(COOKIE.LastCartID) and to a session variable (SESSION.CartID). Once the mini
shopping cart is reached, a query is made to the cart database to find contents
of the cart and will display the data. New customers will return 0 contents
obviously but returning customers who added items in a previous session will
display as such. Now, what I noticed is after adding an item to the cart and
making about 20 or so click throughs on the site, the cart returns 0 items and
with my debugging code on, a whole new cookie ID is created as well as other
session variables (CFID, CFTOKEN, etc.). Using the cfdump feature, I was able to see right before a new cookie.LastCartID is created, new session and cookies for CFID & CFTOKEN are generated.
I'm just wondering if anyone else experienced this and what strategies should I
undertake to resolve this. This is an issue specific to IE browsers. Thanks.
Orlando
Start Free Trial