In addition to the components described earlier in this section, both the atg.projects.store.profile.StoreProfileFormHandler
class and the /atg/userprofiling/PropertyManager
component include functionality to support the recently viewed products feature.
StoreProfileFormHandler
When an anonymous customer browses the Commerce Reference Store web site, a list of recently viewed products is maintained for the customer. If the customer subsequently logs in, the list needs to be persisted. In order to support this functionality, the Commerce Reference Store class atg.projects.store.profile.StoreProfileFormHandler
, which is an extension of atg.commerce.profile.CommerceProfileFormHandler
, includes a property called recentlyViewedProducts
. This property holds a list of the anonymous customer’s recently viewed products so that it can be processed after the customer logs in. Along with the recentlyViewedProducts
property, StoreProfileFormHandler
overrides two of the CommerceProfileFormHandler
methods and adds a new method:
preLoginUser()
: Commerce Reference Store modifies this method so that, if the customer is anonymous, any recently viewed products are stored in theStoreProfileFormHandler.recentlyViewedProducts
property.postLoginUser()
: Commerce Reference Store modifies this method so that, if the anonymous customer successfully logs in, thepostLoginAddRecentlyViewed()
is invoked.postLoginAddRecentlyViewed()
: This method updates the logged in customer’srecentlyViewedProducts
profile property with the products stored in theStoreProfileFormHandler.recentlyViewedProducts
property.
PropertyManager
The /atg/userprofiling/PropertyManager
component holds a map of repository item property names and the hard-coded references to those properties used in the Commerce Reference Store code base. This map is useful in cases where a repository item property name changes. In such situations, you only need to update the repository item property name in the PropertyManager
component, instead of having to update all of the references to the property name in the Java code. The recently viewed properties that are added to the PropertyManager
component include:
# recentlyViewedProduct names recentlyViewedProductItemDescriptorName=recentlyViewedProduct productPropertyName=product siteIdPropertyName=siteId timeStampPropertyName=timestamp
The PropertyManager
component is of class atg.projects.store.profile.StorePropertyManager
, which is an extension of the atg.commerce.profile.CommercePropertyManager
class.