5 Replies Latest reply on May 23, 2006 2:22 AM by BKBK

    session trouble

    Leftbower Level 1
      I am setting up a shopping cart app and am running into some issues... in my Application.cfc, onSessionStart I am creating an object instance of User in the session:

      <cffunction name="onSessionStart" returnType="void" output="false">
      <cfset SESSION.user = createObject("component","User").init()>

      The User.cfc looks like this:

      <cffunction name="init" access="public" returntype="struct">
      <cfset var user = structNew()>
      <cfset user.userID="#createuuid()#">
      <cfset user.cart = createObject("component", "ShoppingCart").init()>
      <cfset user.info = createObject("component", "UserInfo").init()>
      <cfreturn user>

      The ShoppingCart.cfc starts like this:

      <cfcomponent output="false">
      <!--- Initialize the cart’s contents --->
      <cffunction name="init" access="public" output="false" returntype="ShoppingCart">
      <cfset VARIABLES.cart = ArrayNew(1)>
      <cfreturn this />

      and the UserInfo.cfc starts like this:

      <cffunction name="init" access="public" output="false" returntype="UserInfo">
      <cfset VARIABLES.info = StructNew()>
      <cfreturn this />

      Is this a proper way to set this up? I have gotten some intermitant session errors (e.g. "user.info.something is an undefined java...")

      Also - are there any issues/best practices that I ought to be aware of that could arise with customers using tabbed browsing or multiple browser instances?

      Thanks in advance!