Merchants can define configurable product types, which allow their customers to personalize products in their shopping cart prior to purchasing them. For example, a shopper purchasing a T-shirt may want to personalize it with a custom logo that they've uploaded. Or a shopper purchasing jewelery may want to specify text to be engraved. The new gift certificate is an implementation of a personalizable shopping item.
The basic steps for creating a personalized product type are:
- Create a custom ShoppingItemFormBean implementation with the fields you need to store the personalized data.
- Decorate the default ShoppingItemFormBeanImpl implementation with your custom shopping item form bean.
- Extend the ShoppingItemFormBeanContainerFactoryImpl and override the createCartFormBean methods to initialize the personalized data fields in the form bean.
- Extend the default ShoppingItemDtoMapperImpl and override doItemFieldsMapping to copy personalized form data to ShoppingItemDto fields.
- Create a class that implements ShoppingItemValidator to validate data in personalized fields.
- Create the validation rules in ESAPI.properties in both the storefront and CM server.
- Override the shoppingItemConfigController bean definition to include your ShoppingItemValidator implementation in the productTypeNameControllerMap .
See the GiftCertificateFormBean implementation for an example. For a detailed walkthrough of the required steps, see Tutorial 2 - Configuring a personalized product.