Class ProductConfigAddToCartHookImpl
java.lang.Object
de.hybris.platform.sap.productconfig.services.impl.ProductConfigAddToCartHookImpl
- All Implemented Interfaces:
CommerceAddToCartMethodHook
CPQ AddToCart hook.
This hook is executed before and after addToCart. Main purpose is to ensure that there is a runtime configuration for each configurable product attached to the cart entry. This will already be the case if the add to cart action was triggered from the configuration screen. However if a configurable product is added to cart directly from catalog, without configurating it beforehand, no runtime configuration exists, so the default configuration will be instantiated and attached to the cart item.
Additionally this hook will ensure that the add to cart will always produce a new cart entry in case of configurable products. Merging two configurable products into one cart entry does not make sense, as they might have a different runtime configuration.
This hook is executed before and after addToCart. Main purpose is to ensure that there is a runtime configuration for each configurable product attached to the cart entry. This will already be the case if the add to cart action was triggered from the configuration screen. However if a configurable product is added to cart directly from catalog, without configurating it beforehand, no runtime configuration exists, so the default configuration will be instantiated and attached to the cart item.
Additionally this hook will ensure that the add to cart will always produce a new cart entry in case of configurable products. Merging two configurable products into one cart entry does not make sense, as they might have a different runtime configuration.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidafterAddToCart(CommerceCartParameter parameters, CommerceCartModification result) Execute custom logic after adding product to cartvoidbeforeAddToCart(CommerceCartParameter parameters) Execute custom logic before adding product to cartprotected voidprotected voidprotected CommerceCartServiceprotected CPQConfigurableCheckerprotected ModelServiceprotected ProductConfigurationServiceprotected TrackingRecordervoidsetAbstractOrderEntryLinkStrategy(ConfigurationAbstractOrderEntryLinkStrategy configurationAbstractOrderEntryLinkStrategy) voidsetCommerceCartService(CommerceCartService commerceCartService) voidsetConfigurationAbstractOrderIntegrationStrategy(ConfigurationAbstractOrderIntegrationStrategy configurationAbstractOrderIntegrationStrategy) voidsetConfigurationPricingOrderIntegrationService(ProductConfigurationOrderIntegrationService configurationPricingOrderIntegrationService) voidsetCpqConfigurableChecker(CPQConfigurableChecker cpqConfigurableChecker) Set helper, to check if the related product is CPQ configurableprotected voidvoidsetModelService(ModelService modelService) voidsetProductConfigurationService(ProductConfigurationService productConfigurationService) voidsetRecorder(TrackingRecorder recorder)
-
Constructor Details
-
ProductConfigAddToCartHookImpl
public ProductConfigAddToCartHookImpl()
-
-
Method Details
-
beforeAddToCart
public void beforeAddToCart(CommerceCartParameter parameters) throws CommerceCartModificationException Description copied from interface:CommerceAddToCartMethodHookExecute custom logic before adding product to cart- Specified by:
beforeAddToCartin interfaceCommerceAddToCartMethodHook- Parameters:
parameters- A parameter object- Throws:
CommerceCartModificationException
-
createConfigurationForVariantForNotConfiguredCartEntries
protected void createConfigurationForVariantForNotConfiguredCartEntries(CommerceCartParameter parameters) -
createDefaultConfigForNotConfiguredCartEntries
-
setCreateNewEntryForConfigurableProduct
-
afterAddToCart
public void afterAddToCart(CommerceCartParameter parameters, CommerceCartModification result) throws CommerceCartModificationException Description copied from interface:CommerceAddToCartMethodHookExecute custom logic after adding product to cart- Specified by:
afterAddToCartin interfaceCommerceAddToCartMethodHook- Parameters:
parameters- A parameter objectresult- A return value of addToCart method- Throws:
CommerceCartModificationException
-
getModelService
-
setModelService
- Parameters:
modelService- injects the hybris model service
-
getProductConfigurationService
-
setProductConfigurationService
- Parameters:
productConfigurationService- the productConfigurationService to set
-
getAbstractOrderEntryLinkStrategy
-
setAbstractOrderEntryLinkStrategy
public void setAbstractOrderEntryLinkStrategy(ConfigurationAbstractOrderEntryLinkStrategy configurationAbstractOrderEntryLinkStrategy) -
getCommerceCartService
-
setCommerceCartService
- Parameters:
commerceCartService- ibjects the cart sevice for interaction with the cart
-
getRecorder
-
setRecorder
- Parameters:
recorder- cpq tracking recorder, for recording cart actions
-
getConfigurationPricingOrderIntegrationService
protected ProductConfigurationOrderIntegrationService getConfigurationPricingOrderIntegrationService() -
setConfigurationPricingOrderIntegrationService
public void setConfigurationPricingOrderIntegrationService(ProductConfigurationOrderIntegrationService configurationPricingOrderIntegrationService) - Parameters:
configurationPricingOrderIntegrationService- the configurationPricingOrderIntegrationService to set
-
getCpqConfigurableChecker
-
setCpqConfigurableChecker
Set helper, to check if the related product is CPQ configurable- Parameters:
cpqConfigurableChecker- configurator checker
-
setConfigurationAbstractOrderIntegrationStrategy
public void setConfigurationAbstractOrderIntegrationStrategy(ConfigurationAbstractOrderIntegrationStrategy configurationAbstractOrderIntegrationStrategy) - Parameters:
configurationAbstractOrderIntegrationStrategy-
-
getConfigurationAbstractOrderIntegrationStrategy
protected ConfigurationAbstractOrderIntegrationStrategy getConfigurationAbstractOrderIntegrationStrategy()
-