Class CartPageController
- java.lang.Object
-
- de.hybris.platform.acceleratorstorefrontcommons.controllers.AbstractController
-
- de.hybris.platform.acceleratorstorefrontcommons.controllers.pages.AbstractPageController
-
- de.hybris.platform.acceleratorstorefrontcommons.controllers.pages.AbstractCartPageController
-
- de.hybris.platform.b2ctelcoaddon.controllers.pages.CartPageController
-
@Controller @Scope("tenant") @RequestMapping("/cart") public class CartPageController extends AbstractCartPageControllerController of the cart page and related cart operations, like remove or update cart.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class de.hybris.platform.acceleratorstorefrontcommons.controllers.AbstractController
AbstractController.HttpNotFoundException
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringBASKET_REMOVE_MESSAGEstatic java.lang.StringBASKET_UPDATE_MESSAGEstatic java.lang.StringCART_BREADCRUMB_KEYstatic java.lang.StringCART_CHECKOUT_ERRORstatic java.lang.StringCART_CMS_PAGE_LABELstatic java.lang.StringPAGE_TYPE_ATTRIBUTEstatic java.lang.StringREDIRECT_TO_CART_URLstatic java.lang.StringSHOW_CHECKOUT_FLOWS_CONFIG_KEYstatic java.lang.StringSUBSCRIPTION_PRODUCT_BASKET_ERRORstatic java.lang.StringSUBSCRIPTION_PRODUCT_ERROR_REGEXstatic java.lang.StringTYPE_MISMATCH_ERROR_CODE-
Fields inherited from class de.hybris.platform.acceleratorstorefrontcommons.controllers.pages.AbstractPageController
CMS_PAGE_MODEL, CMS_PAGE_TITLE, PAGE_ROOT, REDIRECT_TO_LOGIN_FOR_CHECKOUT, REDIRECT_TO_MULTISTEP_CHECKOUT, REGISTRATION_CONSENT_ID, UTF_8
-
Fields inherited from class de.hybris.platform.acceleratorstorefrontcommons.controllers.AbstractController
FORWARD_PREFIX, REDIRECT_PREFIX, ROOT
-
-
Constructor Summary
Constructors Constructor Description CartPageController()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.StringcartCheck(org.springframework.ui.Model model, org.springframework.web.servlet.mvc.support.RedirectAttributes redirectModel)Handle the '/cart/checkout' request url.protected voidcreateProductList(org.springframework.ui.Model model)java.lang.StringdeleteCartBundle(@Valid DeleteBundleForm form, org.springframework.ui.Model model, org.springframework.validation.BindingResult bindingResult, org.springframework.web.servlet.mvc.support.RedirectAttributes redirectModel)Deletes all cart entries corresponding to the bundle with the number given from the current cart.protected ResourceBreadcrumbBuildergetResourceBreadcrumbBuilder()protected voidhandleUpdateQuantityFailure(long newQuantity, javax.servlet.http.HttpServletRequest request, org.springframework.web.servlet.mvc.support.RedirectAttributes redirectModel, CartModificationData cartModification)Handles the case when the update quantity call failed by adding corresponding error messages on the redirectModel.voidinitBinder(org.springframework.web.bind.WebDataBinder binder)java.lang.StringinitCheck(org.springframework.ui.Model model, org.springframework.web.servlet.mvc.support.RedirectAttributes redirectModel, CheckoutFlowEnum checkoutFlow, CheckoutPciOptionEnum checkoutPci)booleanisCheckoutStrategyVisible()Retrieves the configured value for theSHOW_CHECKOUT_FLOWS_CONFIG_KEY.protected voidpopulatePageModelWithErrors(org.springframework.ui.Model model, org.springframework.validation.BindingResult bindingResult)Populates the page model with the errors found on the binding result given.voidsetResourceBreadcrumbBuilder(ResourceBreadcrumbBuilder resourceBreadcrumbBuilder)java.lang.StringshowCart(org.springframework.ui.Model model)Displays the cart page.java.lang.StringupdateCartQuantities(long entryNumber, org.springframework.ui.Model model, @Valid UpdateQuantityForm form, org.springframework.validation.BindingResult bindingResult, javax.servlet.http.HttpServletRequest request, org.springframework.web.servlet.mvc.support.RedirectAttributes redirectModel)Update the quantity of the product for the entry with the number given.-
Methods inherited from class de.hybris.platform.acceleratorstorefrontcommons.controllers.pages.AbstractCartPageController
clearSessionRestorationData, continueUrl, createProductEntryList, getCartFacade, getCheckoutFacade, getSessionService, getSiteConfigService, prepareDataForPage, setupCartPageRestorationData, validateCart
-
Methods inherited from class de.hybris.platform.acceleratorstorefrontcommons.controllers.pages.AbstractPageController
addRegistrationConsentDataToModel, checkRequestUrl, createMetaElement, decodeWithScheme, getBaseSiteService, getCheckoutRedirectUrl, getCmsPageService, getCmsPreviewService, getCmsSiteService, getConfigurationService, getConsentFacade, getContentPageForLabelOrId, getCurrencies, getCurrentCurrency, getCurrentLanguage, getCustomerFacade, getHostConfigService, getI18nService, getLanguages, getMessageSource, getPageTitleResolver, getRequestContextData, getSiteName, getSiteUid, getStoreSessionFacade, getUser, getUserFacade, getViewForPage, getViewForPage, prepareNotFoundPage, setUpMetaData, setUpMetaDataForContentPage, storeCmsPageInModel, storeContentPageTitleInModel, storeContinueUrl, urlEncode
-
Methods inherited from class de.hybris.platform.acceleratorstorefrontcommons.controllers.AbstractController
addRequestToModel, getBean
-
-
-
-
Field Detail
-
SHOW_CHECKOUT_FLOWS_CONFIG_KEY
public static final java.lang.String SHOW_CHECKOUT_FLOWS_CONFIG_KEY
- See Also:
- Constant Field Values
-
CART_CMS_PAGE_LABEL
public static final java.lang.String CART_CMS_PAGE_LABEL
- See Also:
- Constant Field Values
-
CART_CHECKOUT_ERROR
public static final java.lang.String CART_CHECKOUT_ERROR
- See Also:
- Constant Field Values
-
PAGE_TYPE_ATTRIBUTE
public static final java.lang.String PAGE_TYPE_ATTRIBUTE
- See Also:
- Constant Field Values
-
CART_BREADCRUMB_KEY
public static final java.lang.String CART_BREADCRUMB_KEY
- See Also:
- Constant Field Values
-
REDIRECT_TO_CART_URL
public static final java.lang.String REDIRECT_TO_CART_URL
- See Also:
- Constant Field Values
-
TYPE_MISMATCH_ERROR_CODE
public static final java.lang.String TYPE_MISMATCH_ERROR_CODE
- See Also:
- Constant Field Values
-
SUBSCRIPTION_PRODUCT_ERROR_REGEX
public static final java.lang.String SUBSCRIPTION_PRODUCT_ERROR_REGEX
- See Also:
- Constant Field Values
-
SUBSCRIPTION_PRODUCT_BASKET_ERROR
public static final java.lang.String SUBSCRIPTION_PRODUCT_BASKET_ERROR
- See Also:
- Constant Field Values
-
BASKET_REMOVE_MESSAGE
public static final java.lang.String BASKET_REMOVE_MESSAGE
- See Also:
- Constant Field Values
-
BASKET_UPDATE_MESSAGE
public static final java.lang.String BASKET_UPDATE_MESSAGE
- See Also:
- Constant Field Values
-
-
Method Detail
-
isCheckoutStrategyVisible
@ModelAttribute("showCheckoutStrategies") public boolean isCheckoutStrategyVisible()Retrieves the configured value for theSHOW_CHECKOUT_FLOWS_CONFIG_KEY.- Returns:
- configured value for the
SHOW_CHECKOUT_FLOWS_CONFIG_KEYor false if none is provided
-
showCart
@RequestMapping(method=GET) public java.lang.String showCart(org.springframework.ui.Model model) throws de.hybris.platform.cms2.exceptions.CMSItemNotFoundExceptionDisplays the cart page.- Parameters:
model- page model to be populated with information- Returns:
- name of the view to be displayed
- Throws:
de.hybris.platform.cms2.exceptions.CMSItemNotFoundException- if the CmsPage cannot be found, while populating the model with meta data or title information
-
cartCheck
@RequestMapping(value="/checkout", method=GET) public java.lang.String cartCheck(org.springframework.ui.Model model, org.springframework.web.servlet.mvc.support.RedirectAttributes redirectModel)Handle the '/cart/checkout' request url. This method checks to see if the cart is valid before allowing the checkout to begin. Note that this method does not require the user to be authenticated and therefore allows us to validate that the cart is valid without first forcing the user to login. The cart will be checked again once the user has logged in.- Parameters:
model- the spring Model object. not used here, but included in the signature to allow overriding in subclasses.- Returns:
- The page to redirect to
-
initCheck
@RequestMapping(value="/checkout/select-flow", method=GET) public java.lang.String initCheck(org.springframework.ui.Model model, org.springframework.web.servlet.mvc.support.RedirectAttributes redirectModel, @RequestParam(value="flow",required=false) CheckoutFlowEnum checkoutFlow, @RequestParam(value="pci",required=false) CheckoutPciOptionEnum checkoutPci)- Parameters:
model- the Spring Model object. Included to allow subclass overriding.redirectModel- the RedirectAttributes object. Included to allow subclass overriding.
-
deleteCartBundle
@RequestMapping(value="/delete", method=POST) public java.lang.String deleteCartBundle(@Valid @Valid DeleteBundleForm form, org.springframework.ui.Model model, org.springframework.validation.BindingResult bindingResult, org.springframework.web.servlet.mvc.support.RedirectAttributes redirectModel) throws de.hybris.platform.cms2.exceptions.CMSItemNotFoundExceptionDeletes all cart entries corresponding to the bundle with the number given from the current cart.- Parameters:
form- bundle delete form, indicating the bundle No to be deletedmodel- page model to be populated with informationbindingResult- request binding result to retrieve validation errors fromredirectModel- page model used for redirection to be populated with information- Returns:
- the url to which the request will be redirected
- Throws:
de.hybris.platform.cms2.exceptions.CMSItemNotFoundException- if the CmsPage cannot be found, while populating the model with meta data or title information
-
updateCartQuantities
@RequestMapping(value="/update", method=POST) public java.lang.String updateCartQuantities(@RequestParam("entryNumber") long entryNumber, org.springframework.ui.Model model, @Valid @Valid UpdateQuantityForm form, org.springframework.validation.BindingResult bindingResult, javax.servlet.http.HttpServletRequest request, org.springframework.web.servlet.mvc.support.RedirectAttributes redirectModel) throws de.hybris.platform.cms2.exceptions.CMSItemNotFoundExceptionUpdate the quantity of the product for the entry with the number given.- Parameters:
entryNumber- entry number of the cart entry to be updatedmodel- page model to be populated with informationform- update quantity form specifying the new quantity of the product from the entry with the number givenbindingResult- request binding result to retrieve validation errors fromrequest- http request to retrieve the url fromredirectModel- redirect model to be populated with information- Returns:
- the url to the result page
- Throws:
de.hybris.platform.cms2.exceptions.CMSItemNotFoundException- if the CmsPage cannot be found, while populating the model with meta data or title information
-
handleUpdateQuantityFailure
protected void handleUpdateQuantityFailure(long newQuantity, javax.servlet.http.HttpServletRequest request, org.springframework.web.servlet.mvc.support.RedirectAttributes redirectModel, CartModificationData cartModification)Handles the case when the update quantity call failed by adding corresponding error messages on the redirectModel.- Parameters:
newQuantity- the new quantity, as set by the customerrequest- http request to retrieve the url fromredirectModel- redirect model to be populated with informationcartModification- resulting cart modification after applying the quantity update
-
populatePageModelWithErrors
protected void populatePageModelWithErrors(org.springframework.ui.Model model, org.springframework.validation.BindingResult bindingResult)Populates the page model with the errors found on the binding result given.- Parameters:
model- page model to be populated with errorsbindingResult- binding result to retrieve the errors from
-
createProductList
protected void createProductList(org.springframework.ui.Model model) throws de.hybris.platform.cms2.exceptions.CMSItemNotFoundException- Overrides:
createProductListin classAbstractCartPageController- Throws:
de.hybris.platform.cms2.exceptions.CMSItemNotFoundException
-
getResourceBreadcrumbBuilder
protected ResourceBreadcrumbBuilder getResourceBreadcrumbBuilder()
-
setResourceBreadcrumbBuilder
public void setResourceBreadcrumbBuilder(ResourceBreadcrumbBuilder resourceBreadcrumbBuilder)
-
initBinder
@InitBinder public void initBinder(org.springframework.web.bind.WebDataBinder binder)
-
-