org.broadleafcommerce.core.web.controller.cart
Class BroadleafCartController

java.lang.Object
  extended by org.broadleafcommerce.common.web.controller.BroadleafAbstractController
      extended by org.broadleafcommerce.core.web.controller.cart.AbstractCartController
          extended by org.broadleafcommerce.core.web.controller.cart.BroadleafCartController

public class BroadleafCartController
extends AbstractCartController

In charge of performing the various modify cart operations

Author:
Andre Azzolini (apazzolini)

Field Summary
protected static String cartPageRedirect
           
protected static String cartView
           
 
Fields inherited from class org.broadleafcommerce.core.web.controller.cart.AbstractCartController
catalogService, offerService, orderService
 
Constructor Summary
BroadleafCartController()
           
 
Method Summary
 String add(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, org.springframework.ui.Model model, AddToCartItem itemRequest)
          Takes in an item request, adds the item to the customer's current cart, and returns.
 String addPromo(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, org.springframework.ui.Model model, String customerOffer)
          Attempts to add provided Offer to Cart
 String cart(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, org.springframework.ui.Model model)
          Renders the cart page.
 String empty(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, org.springframework.ui.Model model)
          Cancels the current cart and redirects to the homepage
 String getCartPageRedirect()
           
 String getCartView()
           
 String remove(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, org.springframework.ui.Model model, AddToCartItem itemRequest)
          Takes in an item request, updates the quantity of that item in the cart, and returns If the method was invoked via an AJAX call, it will render the "ajax/cart" template.
 String removePromo(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, org.springframework.ui.Model model, Long offerCodeId)
          Removes offer from cart
 String updateQuantity(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, org.springframework.ui.Model model, AddToCartItem itemRequest)
          Takes in an item request and updates the quantity of that item in the cart.
 
Methods inherited from class org.broadleafcommerce.common.web.controller.BroadleafAbstractController
isAjaxRequest
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

cartView

protected static String cartView

cartPageRedirect

protected static String cartPageRedirect
Constructor Detail

BroadleafCartController

public BroadleafCartController()
Method Detail

cart

public String cart(javax.servlet.http.HttpServletRequest request,
                   javax.servlet.http.HttpServletResponse response,
                   org.springframework.ui.Model model)
            throws PricingException
Renders the cart page. If the method was invoked via an AJAX call, it will render the "ajax/cart" template. Otherwise, it will render the "cart" template.

Parameters:
request -
response -
model -
Throws:
PricingException

add

public String add(javax.servlet.http.HttpServletRequest request,
                  javax.servlet.http.HttpServletResponse response,
                  org.springframework.ui.Model model,
                  AddToCartItem itemRequest)
           throws IOException,
                  AddToCartException,
                  PricingException
Takes in an item request, adds the item to the customer's current cart, and returns. If the method was invoked via an AJAX call, it will render the "ajax/cart" template. Otherwise, it will perform a 302 redirect to "/cart"

Parameters:
request -
response -
model -
itemRequest -
Throws:
IOException
AddToCartException
PricingException

updateQuantity

public String updateQuantity(javax.servlet.http.HttpServletRequest request,
                             javax.servlet.http.HttpServletResponse response,
                             org.springframework.ui.Model model,
                             AddToCartItem itemRequest)
                      throws IOException,
                             UpdateCartException,
                             PricingException,
                             RemoveFromCartException
Takes in an item request and updates the quantity of that item in the cart. If the quantity was passed in as 0, it will remove the item. If the method was invoked via an AJAX call, it will render the "ajax/cart" template. Otherwise, it will perform a 302 redirect to "/cart"

Parameters:
request -
response -
model -
itemRequest -
Throws:
IOException
PricingException
UpdateCartException
RemoveFromCartException

remove

public String remove(javax.servlet.http.HttpServletRequest request,
                     javax.servlet.http.HttpServletResponse response,
                     org.springframework.ui.Model model,
                     AddToCartItem itemRequest)
              throws IOException,
                     PricingException,
                     RemoveFromCartException
Takes in an item request, updates the quantity of that item in the cart, and returns If the method was invoked via an AJAX call, it will render the "ajax/cart" template. Otherwise, it will perform a 302 redirect to "/cart"

Parameters:
request -
response -
model -
nonAjaxSuccessUrl -
itemRequest -
Throws:
IOException
PricingException
RemoveFromCartException

empty

public String empty(javax.servlet.http.HttpServletRequest request,
                    javax.servlet.http.HttpServletResponse response,
                    org.springframework.ui.Model model)
             throws PricingException
Cancels the current cart and redirects to the homepage

Parameters:
request -
response -
model -
Throws:
PricingException

addPromo

public String addPromo(javax.servlet.http.HttpServletRequest request,
                       javax.servlet.http.HttpServletResponse response,
                       org.springframework.ui.Model model,
                       String customerOffer)
                throws IOException,
                       PricingException
Attempts to add provided Offer to Cart

Parameters:
request -
response -
model -
customerOffer -
Returns:
the return view
Throws:
IOException
PricingException
ItemNotFoundException
OfferMaxUseExceededException

removePromo

public String removePromo(javax.servlet.http.HttpServletRequest request,
                          javax.servlet.http.HttpServletResponse response,
                          org.springframework.ui.Model model,
                          Long offerCodeId)
                   throws IOException,
                          PricingException
Removes offer from cart

Parameters:
request -
response -
model -
offerId -
Returns:
the return view
Throws:
IOException
PricingException
ItemNotFoundException
OfferMaxUseExceededException

getCartView

public String getCartView()

getCartPageRedirect

public String getCartPageRedirect()


Copyright © 2013. All Rights Reserved.