Isnâ€™t it iconic? by Mykl Roventine
eCommerce sites want to make their usersâ€™ experience as convenient and intuitive as possible.Â One convenience found on most major eCommerce sites is remembering what the user put in his shopping cart, even if that person didnâ€™t log in.Â Therefore when the user returns to the site he will see what he left in his shopping cart.
ATG makes it relatively simple to do this by:
- creating a profile in the repository (database) for all users that visit the website
- automatically logging in users by cookie
Therefore if a user returns, she/he will be automatically logged in and if there were any items in his cart they will be added to the current cart.
- Turn on persisting anonymous profiles in the ProfileRequestServlet.
# /atg/dynamo/servlet/dafpipeline/ProfileRequestServlet persistAfterLogout=true persistentAnonymousProfiles=true
- Turn on auto-login by cookie and turn off auto-login by basic authentication.
# /atg/userprofiling/CookieManager sendProfileCookies=true # /atg/userprofiling/ProfileRequestServlet verifyBasicAuthentication=false
- Make all profile properties not required except for login and password in userProfile.xml.Â Also make autoLogin true.
When a profile is created for an anonymous user the login and password are set to the userâ€™s ID (i.e. the profileâ€™s repository ID).
If you are adding this functionality to an existing up and running site you may have to modify your user tables so that there no â€œnot nullâ€ columns except for the id, login and password columns, you can leave those as how they were.Â Also you will need to set auto_login to true for all your existing users.
update dps_user set auto_login = 1;
To determine when the anonymous user was created look at the registrationDate profile property.Â To determine when was the last time the anonymous user logged in look at the lastActivity profile property.Â Both of these are updated by ATGâ€™s TrackActivity scenario which is in the DSS folder.
Finally doÂ not turn on persistent anonymous profiles in the BCC. It will stop working if you do that.
For further reading please see Tracking Guest Users and Tracking Registered Users in the ATG 9.1 Personalization Programming Guide.
Do you need to also set the following configuration properties in order for the cart to be persisted:
# Settings for persisting shoppingCart for logged in users
# Setting for persisting shopping cart of anonymous users
I haven’t seen those properties ever before. Which component is that?
These are located in the ShoppingCart.properties
I am using Ver 10.x
What would a SQL look like if I am trying to remove order from db. I ask because I have millions of records created that causes out of memory error on app server.
This is not easy, especially if you have any extensions to the order repository item. What I usually do is write a Java service that gets all the orders that fit a certain criteria from the repository and then delete them.
David you are correct but honestly I’ve never used those settings. I’d have to look at the code to see what they do. I’ve actually moved away from persisting orders for anonymous users using this mechanism and instead moved to a different method. I’ll need to write a post about that. 🙂
I ended up going with a pure cookie based solution for both anonymous and registered users on the site. So now the only thing that gets persisted to the orders table are true orders. I created a Cart Restore servlet to run in the pipeline, only runs once per session. Then made modifications to the cookie manager long with overriding update order. So far working pretty good.
I was taking a look at Hybris the other day and what they have is a cart table and a order table. So they keep these items completely separate which I think makes a nice clean design and data view as well
Your solution sounds something like mine, maybe a lot better. 🙂
That is interesting about Hybris. Hadn’t heard about that platform until now.