Popular Posts

Enabling Persistent Sessions in WCS



If persistent sessions are enabled, a customer at a WebSphere Commerce store will be recognized on subsequent visits to the store, even after the customer closes the browser. To enable persistent sessions, below have to done.

·         Passing rememberMe=true is passed to the Logoff command

By default, the Logoff command deletes the persistent session. But, if rememberMe=true is passed to the Logoff command then the registered user is logged off but remembered making the session persist, and the registered user is able to view the shopping cart. Other information such as order history or addresses cannot be viewed by this user

·         Enabling persistent sessions globally (For both Guest and Registered users)

                                        wc-server.xml --> <SessionManagement> --> <PersistentSession> --> cookieExpiry = 
                                         -1/non-zero (cookie removed at the browser session end/no of days when the cookie will expire)
 
<SessionManagement>
                    <url-rewriting display="false" enabled="false"/>
<cookie acceptance="false" age="-1" display="false" domain="" enabled="true" path="/" persistence="wcs"/>
                    <referrerCookie age="-1"/>
                    <AllowMultipleLogonForSameUser enabled="true"/>
<PersistentSession cookieExpiry="-1" delayNewPersistentGuestSession="true" display="false" enable="true"/>
                    <PersonalizationId display="false" enable="true"/>
</SessionManagement>
 
·         Enabling Persistent sessions for the specific store

Enabling persistent sessions in a single store ensures that your store is configured to handle persistent sessions. This can be done by setting the following values in the PERSISTENTSESSION column of STORE table.

Value
Remember Me Functionality
0 (Default)
Disabled for registered customers and guest customers
1
Enabled for registered customers only
2
Enabled for guest customers only
3
Enabled for registered customers and guest customers

·         Enabling persistent sessions for guest customers (Not defined by default  and used only for guest users - the guest user receives a different expiry date than a registered user)

                                        wc-server.xml --> <SessionManagement> --> <PersistentSession> --> cookieExpiryGuest
                                        
<SessionManagement>
                    <url-rewriting display="false" enabled="false"/>
<cookie acceptance="false" age="-1" display="false" domain="" enabled="true" path="/" persistence="wcs"/>
                    <referrerCookie age="-1"/>
                    <AllowMultipleLogonForSameUser enabled="true"/>
                    <PersistentSession cookieExpiry="-1" cookieExpiryGuest="30"
 delayNewPersistentGuestSession="true" display="false" enable="true"/>
                    <PersonalizationId display="false" enable="true"/>
</SessionManagement>
 
·         Enabling the Migrate Guest Orders Event Listener for guest customers in pesistent sessions

        wc-server.xml --> Migrate Guest Orders Event Listener -->  enable component


                                         This is optional. For example, when persistent sessions are enabled and a guest shopper adds an item to their shopping cart, guest user A is created. If the shopper closes and then opens their web browser again, they can still view the item within the shopping cart. When the shopper adds another item to their cart, or performs an action that is not allowed with persistent sessions, a new guest user B is created. The actions that are allowed by persistent sessions are configured in the corresponding struts configuration file. With guest user B created, the enablement of the event listener determines the shopping cart contents. If enabled, the guest user A shopping cart is migrated to guest user B and the contents of the cart are mergerd. This migration provides the shopper with a consitent shopping experience without the shopper knowing that a second guest user session is created.
 
<component compClassName="com.ibm.commerce.order.event.GuestUserOrderResetEventListener"
      enable="true" name="Migrate Guest Orders Event Listener">
      <property display="false">
                <start enabled="true"/>
      </property>
</component>

1 comment: