public static String keepCartUpdated(HttpServletRequest request,HttpServletResponse response){
  LocalDispatcher dispatcher=(LocalDispatcher)request.getAttribute("dispatcher");
  HttpSession session=request.getSession();
  ShoppingCart cart=getCartObject(request);
  if (cart.getUserLogin() == null) {
    GenericValue userLogin=(GenericValue)session.getAttribute("userLogin");
    if (userLogin != null) {
      try {
        cart.setUserLogin(userLogin,dispatcher);
      }
 catch (      CartItemModifyException e) {
        Debug.logWarning(e,module);
      }
    }
  }
  if (cart.getAutoUserLogin() == null) {
    GenericValue autoUserLogin=(GenericValue)session.getAttribute("autoUserLogin");
    if (autoUserLogin != null) {
      if (cart.getUserLogin() == null) {
        try {
          cart.setAutoUserLogin(autoUserLogin,dispatcher);
        }
 catch (        CartItemModifyException e) {
          Debug.logWarning(e,module);
        }
      }
 else {
        cart.setAutoUserLogin(autoUserLogin);
      }
    }
  }
  Locale locale=UtilHttp.getLocale(request);
  if (cart.getLocale() == null || !locale.equals(cart.getLocale())) {
    cart.setLocale(locale);
  }
  return "success";
}

public static String keepCartUpdated ( HttpServletRequest request , HttpServletResponse response ) { LocalDispatcher dispatcher = ( LocalDispatcher ) request . getAttribute ( "dispatcher" ) ; HttpSession session = request . getSession ( ) ; ShoppingCart cart = getCartObject ( request ) ; if ( cart . getUserLogin ( ) == null ) { GenericValue userLogin = ( GenericValue ) session . getAttribute ( "userLogin" ) ; if ( userLogin != null ) { try { cart . setUserLogin ( userLogin , dispatcher ) ; } catch ( CartItemModifyException e ) { Debug . logWarning ( e , module ) ; } } } if ( cart . getAutoUserLogin ( ) == null ) { GenericValue autoUserLogin = ( GenericValue ) session . getAttribute ( "autoUserLogin" ) ; if ( autoUserLogin != null ) { if ( cart . getUserLogin ( ) == null ) { try { cart . setAutoUserLogin ( autoUserLogin , dispatcher ) ; } catch ( CartItemModifyException e ) { Debug . logWarning ( e , module ) ; } } else { cart . setAutoUserLogin ( autoUserLogin ) ; } } } Locale locale = UtilHttp . getLocale ( request ) ; if ( cart . getLocale ( ) == null || ! locale . equals ( cart . getLocale ( ) ) ) { cart . setLocale ( locale ) ; } return "success" ; }
update the cart ' s userlogin object if it isn ' t already set .
