Class ProductConfigAddToCartHookImpl
- java.lang.Object
-
- de.hybris.platform.sap.productconfig.services.impl.ProductConfigAddToCartHookImpl
-
- All Implemented Interfaces:
CommerceAddToCartMethodHook
public class ProductConfigAddToCartHookImpl extends java.lang.Object implements 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 configuraing 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 Constructor Description ProductConfigAddToCartHookImpl()
-
Method Summary
-
-
-
Method Detail
-
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
protected void createDefaultConfigForNotConfiguredCartEntries(CommerceCartParameter parameters)
-
setCreateNewEntryForConfigurableProduct
protected void setCreateNewEntryForConfigurableProduct(CommerceCartParameter parameters)
-
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
protected ModelService getModelService()
-
setModelService
public void setModelService(ModelService modelService)
- Parameters:
modelService- injects the hybris model service
-
getProductConfigurationService
protected ProductConfigurationService getProductConfigurationService()
-
setProductConfigurationService
public void setProductConfigurationService(ProductConfigurationService productConfigurationService)
- Parameters:
productConfigurationService- the productConfigurationService to set
-
getAbstractOrderEntryLinkStrategy
protected ConfigurationAbstractOrderEntryLinkStrategy getAbstractOrderEntryLinkStrategy()
-
setAbstractOrderEntryLinkStrategy
public void setAbstractOrderEntryLinkStrategy(ConfigurationAbstractOrderEntryLinkStrategy configurationAbstractOrderEntryLinkStrategy)
-
getCommerceCartService
protected CommerceCartService getCommerceCartService()
-
setCommerceCartService
public void setCommerceCartService(CommerceCartService commerceCartService)
- Parameters:
commerceCartService- ibjects the cart sevice for interaction with the cart
-
getRecorder
protected TrackingRecorder getRecorder()
-
setRecorder
public void setRecorder(TrackingRecorder recorder)
- 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
protected CPQConfigurableChecker getCpqConfigurableChecker()
-
setCpqConfigurableChecker
public void setCpqConfigurableChecker(CPQConfigurableChecker cpqConfigurableChecker)
Set helper, to check if the related product is CPQ configurable- Parameters:
cpqConfigurableChecker- configurator checker
-
getProductConfigurationPricingStrategy
protected ProductConfigurationPricingStrategy getProductConfigurationPricingStrategy()
-
setProductConfigurationPricingStrategy
public void setProductConfigurationPricingStrategy(ProductConfigurationPricingStrategy productConfigurationPricingStrategy)
- Parameters:
productConfigurationPricingStrategy- the productConfigurationPricingStrategy to set
-
setConfigurationAbstractOrderIntegrationStrategy
public void setConfigurationAbstractOrderIntegrationStrategy(ConfigurationAbstractOrderIntegrationStrategy configurationAbstractOrderIntegrationStrategy)
- Parameters:
configurationAbstractOrderIntegrationStrategy-
-
getConfigurationAbstractOrderIntegrationStrategy
protected ConfigurationAbstractOrderIntegrationStrategy getConfigurationAbstractOrderIntegrationStrategy()
-
-