Catalog browsing lets customers locate products by browsing the catalog hierarchy. Catalog browsing uses filters, sorters and pagination to make it easier for users to find products of interest. For more information on filters, see Filtered navigation.
Key classes and files
- BrowsingControllerImpl - Spring MVC controller for catalog browsing.
- CatalogViewResultBean - Bean containing a browsing result, pagination history, and view history for display by a Velocity template.
In Store Assets:
- categoryTemplate.vm - Default Velocity template for displaying a category-browsing page.
- BrowsingService - Service for browsing a catalog and its products.
- BrowsingRequest - Browsing request representation.
- BrowsingResult - Browsing result representation containing the products to display.
- CategoryService - Service for category tasks.
- ProductLoadTuner - Beans that define how much of a Product's data should be loaded during product retrieval.
How it works
- BrowsingControllerImpl's handleRequestInternal() method is invoked when a user browses a category by clicking a category link.
- BrowsingControllerImpl converts the category code to a category UID using CategoryService.
- BrowsingControllerImpl creates and populates a BrowsingRequest object with data from the HTTP request and the category UID.
- BrowsingControllerImpl calls the BrowsingService with the following input:
- The BrowsingRequest.
- The user's ShoppingCart, which is used to apply promotion rules.
- The ProductLoadTuner, which determines how much of a product's data is loaded.
- BrowsingService creates and populates a BrowsingResult.
- BrowsingService returns the BrowsingResult to BrowsingControllerImpl.
- BrowsingControllerImpl creates a CatalogViewResultBean populated with the BrowsingResult, and returns to the Spring MVC framework.
- categoryTemplate.vm renders the CatalogViewResultBean into HTML viewed by the user.
By default, the data included in each object in the result set is determined by the productLoadTunerForBrowsingAndSearch. For more information, see Load tuners.
- You can configure BrowsingControllerImpl and the product load tuner in the Storefront's url-mapping.xml file.
- If a CatalogViewResultHistory is passed to BrowsingService, BrowsingService will check whether the result in the history can be reused. A result in the history is considered reuseable if the new browsing request is more restricted than the former browsing request. For example, a browisng request of a category with a price filter " $200 - $400" is more restricted than a browisng request of the same category without the price filter.