Introduction
Development
Core
Entity Definitions
The ProductsCompareWidgetEntityDefinition extends the WidgetEntityDefinition. The WidgetEntityDefinition
relies further on the extended AbstractEntityDefinition, AbstractActivatableEntityDefinition, AbstractCatalogableEntityDefinition, AbstractCmsEntityDefinition and AbstractFilterableEntityDefinition:

Spring Data JPA Repositories
The ProductsCompareWidgetRepository extends the ActivatableRepository and the BaseEntityRepository:

This is the corresponding Spring Data JPA repository for the ProductsCompareWidgetEntityDefinition
.
Facade
MapperFactoryConfigurers
The ProductsCompareWidgetMapperFactoryConfigurer implements the MapperFactoryConfigurer:

The registered conversions here are:
-
from
ProductsCompareWidgetEntityDefinition
toProductsCompareWidgetDtoDefinition
, -
from
ProductEntityDefinition
toProductCompareProductDtoDefinition
and -
from
ProductEntityDefinition
toProductCompareListProductDtoDefinition
More about the mapping configurations you may read in the respective Orika guide.
Dto definitions
The ProductCompareListProductDtoDefinition extends the AbstractProductDtoDefinition and the ProductBasicDtoDefinition:

This is the corresponding Dto object for the ProductEntityDefinition
.
The ProductCompareProductDtoDefinition extends the attributes, defined in the AbstractProductDtoDefinition, the ProductBasicDtoDefinition, the ProductDescriptionDtoDefinition, the ProductPriceDtoDefinition, the ProductDiscountDtoDefinition, the ProductUrlDtoDefinition, the ProductVariantOptionsDtoDefinition and the ProductBaseOptionsDtoDefinition:

This is the corresponding Dto object for the ProductEntityDefinition
.
The ProductsCompareWidgetDtoDefinition extends the WidgetDtoDefinition, going further to the AbstractEntityDtoDefinition:

This is the corresponding Dto object for the ProductsCompareWidgetEntityDefinition
.
Facades
The ProductCompareFacade defines the getProductCompareData()
method that returns the resulting map, from the specified Dto comparision.
Storefront
The ProductsCompareWidgetController extends the AbstractWidgetController:

The defined HTTP Endpoints can be accessed at:
-
/add/{productCode}
, -
/remove/{productCode}
and at -
/compare
Some custom JavaScript files handle the appearance and behaviour of the products' comparison. They can be found at resources/META-INF/resources/resources/productscompare/js/script.js