To determine if a request is for a category page, Commerce Reference Store includes a helper component, /atg/endeca/assembler/cartridge/StoreCartridgeTools
. This component determines if the current request is for a category page and, if so, it returns the current category’s ID. The StoreCartridgeTools
component is of class atg.projects.store.assembler.cartridge.StoreCartridgeTools
, which has two methods:
isUserOnCategoryPage()
- Determines whether the user is currently on the category page by checking whether the current navigation state contains theCategoryOnly
user segment. (See Tracking a Customer’s Catalog Navigation for more details on theCategoryOnly
user segment.)getCurrentCategoryId()
- Returns the ID for the category the user is currently viewing. This method first checks whether the user is currently on the category page, using theisUserOnCategoryPage()
method, and, if so, it retrieves the last browsed category ID from the component specified in theStoreCartridgeTools.catalogNavigation
property.
To do its tasks, the StoreCartridgeTools
component has the following properties configured:
catalogNavigation
- TheCatalogNavigation
component where the last browsed category is stored. Set by default to/atg/endeca/assembler/cartridge/manager/NavigationStateBuilder.catalogNavigation
, which resolves to/atg/store/catalog/CatalogNavigation
.userState
- TheUserState
component that holds the user segments list. Set by default to/atg/endeca/assembler/cartridge/manager/NavigationStateBuilder.userState
, which resolves to/atg/endeca/assembler/cartridge/manager/user/LiveUserState
.categoryNavigationUserSegment
- The name of the user segment that indicates a request is for a category page. Set by default to/atg/endeca/assembler/cartridge/manager/NavigationStateBuilder.userSegment
, which resolves toCategoryOnly
.
Because it references other request-scoped components, specifically /atg/endeca/assembler/cartridge/manager/user/LiveUserState
, the StoreCartridgeTools
component is also configured to be request-scoped.