Product display
Product display
This document explains how the storefront displays a product on the product page.
Key classes and files
In Core:
- ProductRetrieveStrategy- Interface for retrieving a list products.
- EhCacheProductRetrieveStrategyImpl - Implementation of ProductRetrieveStrategy that uses the EhCache.
- NoCachingProductRetrieveStrategyImpl - Implementation of ProductRetrieveStrategy that doesn't cache products. Allows products to apply customer-specific rules.
- ProductService - Service for product tasks.
- ProductViewService - Service for retrieving products to display.
- ProductLoadTuner - Tuner for defining how much product data to retrieve during product retrieval.
- StoreProductService - Service for converting the core product domain object into a form more suitable for storefronts.
How it works
- A customer clicks a link to view a product's details, invoking ShoppingItemConfigControllerImpl's getProductFromRequest method.
- ShoppingItemConfigControllerImpl calls the ProductViewServicewith the following input:
- The product code, which is obtained from the HTTP request.
- The customer's ShoppingCart, which is used to apply promotion rules.
- The ProductLoadTuner, which determines how much of a product's data is loaded.
- ProductViewService converts the product into a product UID using ProductService.
- ProductViewService calls StoreProductService, passing in the product UID, ShoppingCart, and ProductLoadTuner.
- StoreProductService uses an implementation of the ProductRetrieveStrategy interface to retrieve the product.
Configuration
You can configure ShoppingItemConfigControllerImpl and the product load tuner in the Storefront's spring/web/url-mapping.xml file.
You can configure which ProductRetrieveStrategy implementation is used in the Core's spring/service/service.xml file.