Announcement: You can find the guides for Commerce 7.5 and later on the new Elastic Path Documentation site. This Developer Center contains the guides for Commerce 6.13.0 through 7.4.1.Visit new site

This version of Elastic Path Commerce is no longer supported or maintained. To upgrade to the latest version, contact your Elastic Path representative.

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.

In Storefront:

  • ShoppingItemConfigControllerImpl - Spring MVC controller responsible for displaying detailed product information.
  • ShoppingItemFormBean - Form bean that retrieves information from the ShoppingCartController to display on the product template.

In Store Assets:

  • productTemplate.vm - Velocity template for displaying detailed product information.
  • productMacros.vm - Velocity macro for displaying products.

How it works

  1. A customer clicks a link to view a product's details, invoking ShoppingItemConfigControllerImpl's getProductFromRequest method.
  2. ShoppingItemConfigControllerImpl calls the ProductViewServicewith the following input:
    1. The product code, which is obtained from the HTTP request.
    2. The customer's ShoppingCart, which is used to apply promotion rules.
    3. The ProductLoadTuner, which determines how much of a product's data is loaded.
  3. ProductViewService converts the product into a product UID using ProductService.
  4. ProductViewService calls StoreProductService, passing in the product UID, ShoppingCart, and ProductLoadTuner.
  5. 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.