private String showCatalog(ModelMap model, HttpServletRequest request, CatalogSort catalogSort) { addCategoryToModel(request, model); boolean productFound = addProductsToModel(request, model, catalogSort); String view = defaultCategoryView; if (productFound) { // TODO: Nice to have: product logic similar to category below view = defaultProductView; } else { Category currentCategory = (Category) model.get("currentCategory"); if (currentCategory.getUrl() != null && !"".equals(currentCategory.getUrl())) { return "redirect:" + currentCategory.getUrl(); } else if (currentCategory.getDisplayTemplate() != null && !"".equals(currentCategory.getUrl())) { view = categoryTemplatePrefix + currentCategory.getDisplayTemplate(); } else { if ("true".equals(request.getParameter("ajax"))) { view = "catalog/categoryView/mainContentFragment"; } else { view = defaultCategoryView; } } } if (catalogSort == null) { model.addAttribute("catalogSort", new CatalogSort()); } List<Order> wishlists = cartService.findOrdersForCustomer(customerState.getCustomer(request), OrderStatus.NAMED); model.addAttribute("wishlists", wishlists); return view; }