/** * Loads the current product uid and breadcrumb data into the model and displays the product * review view. * * @param request -the request * @param response -the response * @return - the ModleAndView instance for the static page. * @throws Exception if anything goes wrong. */ @Override protected ModelAndView handleRequestInternal( final HttpServletRequest request, final HttpServletResponse response) throws Exception { LOG.debug("entering 'handleRequestInternal' method..."); // Get the product view bean with breadcrumb history in it and add it to the model final String productGuid = getProductGuid(request); final Product currentProduct = getProduct(productGuid); final CustomerSession customerSession = getRequestHelper().getCustomerSession(request); final ShoppingCart shoppingCart = customerSession.getShoppingCart(); final ProductViewBean productViewBean = createProductViewBean(currentProduct, shoppingCart); final Map<String, Object> model = new HashMap<String, Object>(); model.put("productViewBean", productViewBean); // Get the PowerReviews merchant id from setting service and pass to model. final SettingValue merchantIdSetting = getRequestHelper() .getStoreConfig() .getSetting("COMMERCE/STORE/POWERREVIEWS/powerReviewsMerchantid"); final int merchantId = Integer.parseInt(merchantIdSetting.getValue()); model.put("merchantID", Integer.valueOf(merchantId)); // Load the success view, passing it the model return new ModelAndView(successView, model); }
/** * Apply a merged cart page redirection URL. * * @param request the request * @return the merged cart landing page for a merged cart scenario, otherwise the original * targetUrl is returned */ protected boolean mergedCartRedirect(final HttpServletRequest request) { final CustomerSession customerSession = requestHelper.getCustomerSession(request); if (customerSession != null) { final ShoppingCart shoppingCart = customerSession.getShoppingCart(); if (shoppingCart.isMergedNotification()) { return true; } } return false; }
/** * Perform a check to see if the language should be changed. * * @param aRequest - request * @param aResponse - response */ protected void processPossibleLocaleChange( final HttpServletRequest aRequest, final HttpServletResponse aResponse) { String localeFromRequest = (String) aRequest.getAttribute(WebConstants.URL_REQUEST_LOCALE); if (localeFromRequest != null && localeFromRequest.length() > 0) { CustomerSession customerSession = requestHelper.getCustomerSession(aRequest); Locale newLocale = getLocaleByLanguageStr(localeFromRequest); if (!newLocale.equals(customerSession.getLocale())) { customerSession.setLocale(newLocale); customerSessionService.update(customerSession); aRequest.setAttribute(WebConstants.LOCALE_PARAMETER_NAME, newLocale); } } }