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.

Merchandizing and Product Associations

Merchandizing and Product Associations

Merchandizing is the practice of displaying related products as the customer browses a product page. For example, a customer browsing a Canon digital camera could be recommended a Sony digital camera.

Merchandizing works by associating the "source" product on display with "target" products the customer may be interested in. If the target product has multiple SKUs, the association can target a specific SKU.

In the code, a product has no direct knowledge of its associated products; ProductAssociation objects maintain an association between "source" and "target" products. To retrieve a product's ProductAssociations, use the ProductAssociationService.

Key classes and files

In Core:

  • ProductAssociation - A representation of the link between a source and target product.
  • ProductAssociationService - A service for performing persistence operations on ProductAssociations.

In Store Assets:

  • VM_global_library.vm - A Velocity macro library that contains methods for displaying product associations.
  • productMacros.vm - A Velocity template for displaying products.

ProductAssociation Properties

ProductAssociation objects have the following properties:

Type Property Description
int associationType The type of merchandising association between the two products. See ProductAssociation Types for more information.
Product sourceProduct The product on display in the storefront.
Product targetProduct The related product.
Catalog catalog The catalog the ProductAssociation applies to.
Date startDate The date the association starts to be applied.
Date endDate The date the association is removed.
int defaultQuantity The quantity of the target accessory added to the cart when the customer purchases the target accessory.
boolean sourceProductDependent

The indicator for whether the target product is a child of the source product. If true, the child can't exist in the cart without the parent.

int ordering The order the target product appears on the source product page relative to other target products.
long uidPk The association's UID generated by OpenJPA.

ProductAssociation Types

Out of the box, there are six types of product associations. Depending on the association type, productMacros.vm displays the target product in different locations.

Product Association Type Description
Cross Sell Promotes alternative products that are similar to the source product. Displayed in a "You May Also Like" section.
Up Sell Promotes more expensive versions of the source product. Displayed in an "Upgrade To" section.
Warranty Promotes "add-on" products. Usually dependent on the source product. Purchasable on the source product page.
Accessory Promotes products that complement the source product. Purchasable on the source product page.
Replacement Promotes alternative products when the source product is out of stock or discontinued. Displayed in a "Replaced By" section.
Product Recommendation Promotes products that were also purchased by customers who purchase the source product. Displayed below the Product Details section.
Note:

Store administrators can create five association types using the Commerce Manager. Product recommendations are automatically generated by Elastic Path.