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 AbstractCartPageController
Controller 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
FieldsModifier and TypeFieldDescriptionstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final StringFields 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_8Fields inherited from class de.hybris.platform.acceleratorstorefrontcommons.controllers.AbstractController
FORWARD_PREFIX, REDIRECT_PREFIX, ROOT -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncartCheck(org.springframework.ui.Model model, org.springframework.web.servlet.mvc.support.RedirectAttributes redirectModel) Handle the '/cart/checkout' request url.protected voidcreateProductEntryList(org.springframework.ui.Model model, CartData cartData) protected voidcreateProductList(org.springframework.ui.Model model) deleteCartBundle(@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 TmaCartFacadeprotected TmaOrderEntryFacadeprotected ResourceBreadcrumbBuilderprotected 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) initCheck(org.springframework.ui.Model model, org.springframework.web.servlet.mvc.support.RedirectAttributes redirectModel, CheckoutFlowEnum checkoutFlow, CheckoutPciOptionEnum checkoutPci) booleanRetrieves 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) showCart(org.springframework.ui.Model model) Displays the cart page.updateCartQuantities(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, getCheckoutFacade, getSessionService, getSiteConfigService, prepareDataForPage, setupCartPageRestorationData, validateCartMethods 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, urlEncodeMethods inherited from class de.hybris.platform.acceleratorstorefrontcommons.controllers.AbstractController
addRequestToModel, getBean
-
Field Details
-
SHOW_CHECKOUT_FLOWS_CONFIG_KEY
- See Also:
-
CART_CMS_PAGE_LABEL
- See Also:
-
CART_CHECKOUT_ERROR
- See Also:
-
PAGE_TYPE_ATTRIBUTE
- See Also:
-
CART_BREADCRUMB_KEY
- See Also:
-
REDIRECT_TO_CART_URL
- See Also:
-
TYPE_MISMATCH_ERROR_CODE
- See Also:
-
SUBSCRIPTION_PRODUCT_ERROR_REGEX
- See Also:
-
SUBSCRIPTION_PRODUCT_BASKET_ERROR
- See Also:
-
BASKET_REMOVE_MESSAGE
- See Also:
-
BASKET_UPDATE_MESSAGE
- See Also:
-
CART_DATA
- See Also:
-
HAS_PICK_UP_CART_ENTRIES
- See Also:
-
-
Constructor Details
-
CartPageController
public CartPageController()
-
-
Method Details
-
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 String showCart(org.springframework.ui.Model model) throws de.hybris.platform.cms2.exceptions.CMSItemNotFoundException Displays 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 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 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 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.CMSItemNotFoundException Deletes 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 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.CMSItemNotFoundException Update 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
-
createProductEntryList
- Overrides:
createProductEntryListin classAbstractCartPageController
-
getResourceBreadcrumbBuilder
-
setResourceBreadcrumbBuilder
-
initBinder
@InitBinder public void initBinder(org.springframework.web.bind.WebDataBinder binder) -
getCartFacade
- Overrides:
getCartFacadein classAbstractCartPageController
-
getOrderEntryFacade
-