1 Reply Latest reply on Apr 18, 2007 7:47 PM by Newsgroup_User

    Easy Question, online store Qty purchase

      I need a bit of help, and I'm not quite proficient in CF really.

      I have built a registration system in CF, which has three steps (pages). On the last step, you can choose to return to Step 1 and register another person, OR you can choose to Pay Now.

      I wanted to use session variable or cookies (I'm not really certain of the difference) to have the system count silently the number of times a visitor has gone through, and then when they do hit "Pay Now", to multiply the variable count X the cost per ticket.

      This is what I have been doing:

      on Step 1, I define the variable session.Quantity with:

      <cfif (NOT isDefined("session.Quantity ")) >
      <cfset session.Quantity = "0" />

      On Step 2, we gather final registration info, and right after the Insert statement, I increase the value of the session.Quantity with:

      <cfset session.Quantity =#session.Quantity #+1>

      On Step 3, I give them the option to Pay Now (which takes the session.Quantity and successfully produces the cost) using:

      <cfoutput> <cfset TotalCost = #session.quantity# * 75></cfoutput> (and then send them to payment and kill session variable)

      OR, I give them the chance to return to step 1 and go through again.

      NOW, this has been working just fine during my testing, UNLESS you close down the browser mid stream (and happen to have another one open in the background), which means that you didn't pay and the session variable didn't get deleted.

      THEN, when you return to the Step 1 again (20min) later, because you want to do the registration over again, after your first registration pass, you are already on session.Quantity = 4 (example).

      OK, so I am a bit green, and I don't know much about the application.cfm process (mine is below) or CFLOCK usage, but I think this is part of my issue. I've read so much, and am now so confused. Can someone give some clear advice and example that I could work through, pertinent to this problem.

      My cfapplication.cfm file:

      <cfapplication name="Application1"


      <cfif StructKeyExists(session, "cfid") AND (NOT StructKeyExists(cookie, "cfid") OR NOT StructKeyExists(cookie, "cftoken"))>
      <cfcookie name="cfid" value="#session.cfid#" />
      <cfcookie name="cftoken" value="#session.cftoken#" />

      Thanks to the SMART people out there,
      Tallahassee, FL