Class 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.
  • Field Details

  • Constructor Details

    • CartPageController

      public CartPageController()
  • Method Details

    • isCheckoutStrategyVisible

      @ModelAttribute("showCheckoutStrategies") public boolean isCheckoutStrategyVisible()
      Retrieves the configured value for the SHOW_CHECKOUT_FLOWS_CONFIG_KEY.
      Returns:
      configured value for the SHOW_CHECKOUT_FLOWS_CONFIG_KEY or 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 deleted
      model - page model to be populated with information
      bindingResult - request binding result to retrieve validation errors from
      redirectModel - 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 updated
      model - page model to be populated with information
      form - update quantity form specifying the new quantity of the product from the entry with the number given
      bindingResult - request binding result to retrieve validation errors from
      request - http request to retrieve the url from
      redirectModel - 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 customer
      request - http request to retrieve the url from
      redirectModel - redirect model to be populated with information
      cartModification - 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 errors
      bindingResult - binding result to retrieve the errors from
    • createProductList

      protected void createProductList(org.springframework.ui.Model model) throws de.hybris.platform.cms2.exceptions.CMSItemNotFoundException
      Overrides:
      createProductList in class AbstractCartPageController
      Throws:
      de.hybris.platform.cms2.exceptions.CMSItemNotFoundException
    • createProductEntryList

      protected void createProductEntryList(org.springframework.ui.Model model, CartData cartData)
      Overrides:
      createProductEntryList in class AbstractCartPageController
    • getResourceBreadcrumbBuilder

      protected ResourceBreadcrumbBuilder getResourceBreadcrumbBuilder()
    • setResourceBreadcrumbBuilder

      public void setResourceBreadcrumbBuilder(ResourceBreadcrumbBuilder resourceBreadcrumbBuilder)
    • initBinder

      @InitBinder public void initBinder(org.springframework.web.bind.WebDataBinder binder)
    • getCartFacade

      protected TmaCartFacade getCartFacade()
      Overrides:
      getCartFacade in class AbstractCartPageController
    • getOrderEntryFacade

      protected TmaOrderEntryFacade getOrderEntryFacade()